/* This notice must be untouched at all times.
Copyright (c) 2002-2008 Walter Zorn. All rights reserved.
wz_tooltip.js	 v. 5.01
The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de
Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com )
Last modified: 26.3.2008
Easy-to-use cross-browser tooltips.
Just include the script at the beginning of the <body> section, and invoke
Tip('Tooltip text') from the desired HTML onmouseover eventhandlers,
and UnTip(), usually from the onmouseout eventhandlers, to hide the tip.
No container DIV required.
By default, width and height of tooltips are automatically adapted to content.
Is even capable of dynamically converting arbitrary HTML elements to tooltips
by calling TagToTip('ID_of_HTML_element_to_be_converted') instead of Tip(),
which means you can put important, search-engine-relevant stuff into tooltips.
Appearance of tooltips can be individually configured
via commands passed to Tip() or TagToTip().
Tab Width: 4
LICENSE: LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For more details on the GNU Lesser General Public License,
see http://www.gnu.org/copyleft/lesser.html
*/
var config = new Object();var  tt_Debug	= true		// false or true - recommended: false once you release your page to the public
var  tt_Enabled	= true		// Allows to (temporarily) suppress tooltips, e.g. by providing the user with a button that sets this global variable to false
var  TagsToTip	= true		// false or true - if true, HTML elements to be converted to tooltips via TagToTip() are automatically hidden;
config. Above			= false 	// false or true - tooltip above mousepointer
config. BgColor 		= '#E2E7FF' // Background colour (HTML colour value, in quotes)
config. BgImg			= ''		// Path to background image, none if empty string ''
config. BorderColor		= '#003099'
config. BorderStyle		= 'solid'	// Any permitted CSS value, but I recommend 'solid', 'dotted' or 'dashed'
config. BorderWidth		= 1
config. CenterMouse		= false 	// false or true - center the tip horizontally below (or above) the mousepointer
config. ClickClose		= false 	// false or true - close tooltip if the user clicks somewhere
config. ClickSticky		= false		// false or true - make tooltip sticky if user left-clicks on the hovered element while the tooltip is active
config. CloseBtn		= false 	// false or true - closebutton in titlebar
config. CloseBtnColors	= ['#990000', '#FFFFFF', '#DD3333', '#FFFFFF']	  // [Background, text, hovered background, hovered text] - use empty strings '' to inherit title colours
config. CloseBtnText	= '&nbsp;X&nbsp;'	// Close button text (may also be an image tag)
config. CopyContent		= true		// When converting a HTML element to a tooltip, copy only the element's content, rather than converting the element by its own
config. Delay			= 400		// Time span in ms until tooltip shows up
config. Duration		= 0 		// Time span in ms after which the tooltip disappears; 0 for infinite duration, < 0 for delay in ms _after_ the onmouseout until the tooltip disappears
config. FadeIn			= 0 		// Fade-in duration in ms, e.g. 400; 0 for no animation
config. FadeOut			= 0
config. FadeInterval	= 30		// Duration of each fade step in ms (recommended: 30) - shorter is smoother but causes more CPU-load
config. Fix				= null		// Fixated position - x- an y-oordinates in brackets, e.g. [210, 480], or null for no fixation
config. FollowMouse		= true		// false or true - tooltip follows the mouse
config. FontColor		= '#000044'
config. FontFace		= 'Verdana,Geneva,sans-serif'
config. FontSize		= '8pt' 	// E.g. '9pt' or '12px' - unit is mandatory
config. FontWeight		= 'normal'	// 'normal' or 'bold';
config. Height			= 0 		// Tooltip height; 0 for automatic adaption to tooltip content, < 0 (e.g. -100) for a maximum for automatic adaption
config. JumpHorz		= false		// false or true - jump horizontally to other side of mouse if tooltip would extend past clientarea boundary
config. JumpVert		= true		// false or true - jump vertically		"
config. Left			= false 	// false or true - tooltip on the left of the mouse
config. OffsetX			= 14		// Horizontal offset of left-top corner from mousepointer
config. OffsetY			= 8 		// Vertical offset
config. Opacity			= 100		// Integer between 0 and 100 - opacity of tooltip in percent
config. Padding			= 3 		// Spacing between border and content
config. Shadow			= false 	// false or true
config. ShadowColor		= '#C0C0C0'
config. ShadowWidth		= 5
config. Sticky			= false 	// false or true - fixate tip, ie. don't follow the mouse and don't hide on mouseout
config. TextAlign		= 'left'	// 'left', 'right' or 'justify'
config. Title			= ''		// Default title text applied to all tips (no default title: empty string '')
config. TitleAlign		= 'left'	// 'left' or 'right' - text alignment inside the title bar
config. TitleBgColor	= ''		// If empty string '', BorderColor will be used
config. TitleFontColor	= '#FFFFFF'	// Color of title text - if '', BgColor (of tooltip body) will be used
config. TitleFontFace	= ''		// If '' use FontFace (boldified)
config. TitleFontSize	= ''		// If '' use FontSize
config. Width			= 0 		// Tooltip width; 0 for automatic adaption to tooltip content; < -1 (e.g. -240) for a maximum width for that automatic adaption;
function Tip()
{
tt_Tip(arguments, null);}
function TagToTip()
{
var t2t = tt_GetElt(arguments[0]);if(t2t)
tt_Tip(arguments, t2t);}
function UnTip()
{
tt_OpReHref();if(tt_aV[DURATION] < 0)
tt_tDurt.Timer("tt_HideInit()", -tt_aV[DURATION], true);else if(!(tt_aV[STICKY] && (tt_iState & 0x2)))
tt_HideInit();}
var tt_aElt = new Array(10), // Container DIV, outer title & body DIVs, inner title & body TDs, closebutton SPAN, shadow DIVs, and IFRAME to cover windowed elements in IE
tt_aV = new Array(),	// Caches and enumerates config data for currently active tooltip
tt_sContent,			// Inner tooltip text or HTML
tt_scrlX = 0, tt_scrlY = 0,
tt_musX, tt_musY,
tt_over,
tt_x, tt_y, tt_w, tt_h; // Position, width and height of currently displayed tooltip
function tt_Extension()
{
tt_ExtCmdEnum();tt_aExt[tt_aExt.length] = this;return this;}
function tt_SetTipPos(x, y)
{
var css = tt_aElt[0].style;tt_x = x;tt_y = y;css.left = x + "px";css.top = y + "px";if(tt_ie56)
{
var ifrm = tt_aElt[tt_aElt.length - 1];if(ifrm)
{
ifrm.style.left = css.left;ifrm.style.top = css.top;}
}
}
function tt_HideInit()
{
if(tt_iState)
{
tt_ExtCallFncs(0, "HideInit");tt_iState &= ~0x4;if(tt_flagOpa && tt_aV[FADEOUT])
{
tt_tFade.EndTimer();if(tt_opa)
{
var n = Math.round(tt_aV[FADEOUT] / (tt_aV[FADEINTERVAL] * (tt_aV[OPACITY] / tt_opa)));tt_Fade(tt_opa, tt_opa, 0, n);return;}
}
tt_tHide.Timer("tt_Hide();", 1, false);}
}
function tt_Hide()
{
if(tt_db && tt_iState)
{
tt_OpReHref();if(tt_iState & 0x2)
{
tt_aElt[0].style.visibility = "hidden";tt_ExtCallFncs(0, "Hide");}
tt_tShow.EndTimer();tt_tHide.EndTimer();tt_tDurt.EndTimer();tt_tFade.EndTimer();if(!tt_op && !tt_ie)
{
tt_tWaitMov.EndTimer();tt_bWait = false;}
if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY])
tt_RemEvtFnc(document, "mouseup", tt_OnLClick);tt_ExtCallFncs(0, "Kill");if(tt_t2t && !tt_aV[COPYCONTENT])
{
tt_t2t.style.display = "none";tt_MovDomNode(tt_t2t, tt_aElt[6], tt_t2tDad);}
tt_iState = 0;tt_over = null;tt_ResetMainDiv();if(tt_aElt[tt_aElt.length - 1])
tt_aElt[tt_aElt.length - 1].style.display = "none";}
}
function tt_GetElt(id)
{
return(document.getElementById ? document.getElementById(id)
: document.all ? document.all[id]
: null);}
function tt_GetDivW(el)
{
return(el ? (el.offsetWidth || el.style.pixelWidth || 0) : 0);}
function tt_GetDivH(el)
{
return(el ? (el.offsetHeight || el.style.pixelHeight || 0) : 0);}
function tt_GetScrollX()
{
return(window.pageXOffset || (tt_db ? (tt_db.scrollLeft || 0) : 0));}
function tt_GetScrollY()
{
return(window.pageYOffset || (tt_db ? (tt_db.scrollTop || 0) : 0));}
function tt_GetClientW()
{
return(document.body && (typeof(document.body.clientWidth) != tt_u) ? document.body.clientWidth
: (typeof(window.innerWidth) != tt_u) ? window.innerWidth
: tt_db ? (tt_db.clientWidth || 0)
: 0);}
function tt_GetClientH()
{
return(document.body && (typeof(document.body.clientHeight) != tt_u) ? document.body.clientHeight
: (typeof(window.innerHeight) != tt_u) ? window.innerHeight
: tt_db ? (tt_db.clientHeight || 0)
: 0);}
function tt_GetEvtX(e)
{
return (e ? ((typeof(e.pageX) != tt_u) ? e.pageX : (e.clientX + tt_scrlX)) : 0);}
function tt_GetEvtY(e)
{
return (e ? ((typeof(e.pageY) != tt_u) ? e.pageY : (e.clientY + tt_scrlY)) : 0);}
function tt_AddEvtFnc(el, sEvt, PFnc)
{
if(el)
{
if(el.addEventListener)
el.addEventListener(sEvt, PFnc, false);else
el.attachEvent("on" + sEvt, PFnc);}
}
function tt_RemEvtFnc(el, sEvt, PFnc)
{
if(el)
{
if(el.removeEventListener)
el.removeEventListener(sEvt, PFnc, false);else
el.detachEvent("on" + sEvt, PFnc);}
}
var tt_aExt = new Array(),	// Array of extension objects
tt_db, tt_op, tt_ie, tt_ie56, tt_bBoxOld,	// Browser flags
tt_body,
tt_ovr_,				// HTML element the mouse is currently over
tt_flagOpa, 			// Opacity support: 1=IE, 2=Khtml, 3=KHTML, 4=Moz, 5=W3C
tt_maxPosX, tt_maxPosY,
tt_iState = 0,			// Tooltip active |= 1, shown |= 2, move with mouse |= 4
tt_opa, 				// Currently applied opacity
tt_bJmpVert, tt_bJmpHorz,// Tip temporarily on other side of mouse
tt_t2t, tt_t2tDad,		// Tag converted to tip, and its parent element in the document
tt_elDeHref,			// The tag from which we've removed the href attribute
tt_tShow = new Number(0), tt_tHide = new Number(0), tt_tDurt = new Number(0),
tt_tFade = new Number(0), tt_tWaitMov = new Number(0),
tt_bWait = false,
tt_u = "undefined";function tt_Init()
{
tt_MkCmdEnum();if(!tt_Browser() || !tt_MkMainDiv())
return;tt_IsW3cBox();tt_OpaSupport();tt_AddEvtFnc(window, "scroll", tt_OnScrl);tt_AddEvtFnc(window, "resize", tt_OnScrl);tt_AddEvtFnc(document, "mousemove", tt_Move);if(TagsToTip || tt_Debug)
tt_SetOnloadFnc();tt_AddEvtFnc(window, "unload", tt_Hide);}
function tt_MkCmdEnum()
{
var n = 0;for(var i in config)
eval("window." + i.toString().toUpperCase() + " = " + n++);tt_aV.length = n;}
function tt_Browser()
{
var n, nv, n6, w3c;n = navigator.userAgent.toLowerCase(),
nv = navigator.appVersion;tt_op = (document.defaultView && typeof(eval("w" + "indow" + "." + "o" + "p" + "er" + "a")) != tt_u);tt_ie = n.indexOf("msie") != -1 && document.all && !tt_op;if(tt_ie)
{
var ieOld = (!document.compatMode || document.compatMode == "BackCompat");tt_db = !ieOld ? document.documentElement : (document.body || null);if(tt_db)
tt_ie56 = parseFloat(nv.substring(nv.indexOf("MSIE") + 5)) >= 5.5
&& typeof document.body.style.maxHeight == tt_u;}
else
{
tt_db = document.documentElement || document.body ||
(document.getElementsByTagName ? document.getElementsByTagName("body")[0]
: null);if(!tt_op)
{
n6 = document.defaultView && typeof document.defaultView.getComputedStyle != tt_u;w3c = !n6 && document.getElementById;}
}
tt_body = (document.getElementsByTagName ? document.getElementsByTagName("body")[0]
: (document.body || null));if(tt_ie || n6 || tt_op || w3c)
{
if(tt_body && tt_db)
{
if(document.attachEvent || document.addEventListener)
return true;}
else
tt_Err("wz_tooltip.js must be included INSIDE the body section,"
+ " immediately after the opening <body> tag.", false);}
tt_db = null;return false;}
function tt_MkMainDiv()
{
if(tt_body.insertAdjacentHTML)
tt_body.insertAdjacentHTML("afterBegin", tt_MkMainDivHtm());else if(typeof tt_body.innerHTML != tt_u && document.createElement && tt_body.appendChild)
tt_body.appendChild(tt_MkMainDivDom());if(window.tt_GetMainDivRefs /* FireFox Alzheimer */ && tt_GetMainDivRefs())
return true;tt_db = null;return false;}
function tt_MkMainDivHtm()
{
return('<div id="WzTtDiV"></div>' +
(tt_ie56 ? ('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>')
: ''));}
function tt_MkMainDivDom()
{
var el = document.createElement("div");if(el)
el.id = "WzTtDiV";return el;}
function tt_GetMainDivRefs()
{
tt_aElt[0] = tt_GetElt("WzTtDiV");if(tt_ie56 && tt_aElt[0])
{
tt_aElt[tt_aElt.length - 1] = tt_GetElt("WzTtIfRm");if(!tt_aElt[tt_aElt.length - 1])
tt_aElt[0] = null;}
if(tt_aElt[0])
{
var css = tt_aElt[0].style;css.visibility = "hidden";css.position = "absolute";css.overflow = "hidden";return true;}
return false;}
function tt_ResetMainDiv()
{
var w = (window.screen && screen.width) ? screen.width : 10000;tt_SetTipPos(-w, 0);tt_aElt[0].innerHTML = "";tt_aElt[0].style.width = (w - 1) + "px";tt_h = 0;}
function tt_IsW3cBox()
{
var css = tt_aElt[0].style;css.padding = "10px";css.width = "40px";tt_bBoxOld = (tt_GetDivW(tt_aElt[0]) == 40);css.padding = "0px";tt_ResetMainDiv();}
function tt_OpaSupport()
{
var css = tt_body.style;tt_flagOpa = (typeof(css.filter) != tt_u) ? 1
: (typeof(css.KhtmlOpacity) != tt_u) ? 2
: (typeof(css.KHTMLOpacity) != tt_u) ? 3
: (typeof(css.MozOpacity) != tt_u) ? 4
: (typeof(css.opacity) != tt_u) ? 5
: 0;}
function tt_SetOnloadFnc()
{
tt_AddEvtFnc(document, "DOMContentLoaded", tt_HideSrcTags);tt_AddEvtFnc(window, "load", tt_HideSrcTags);if(tt_body.attachEvent)
tt_body.attachEvent("onreadystatechange",
function() {
if(tt_body.readyState == "complete")
tt_HideSrcTags();} );if(/WebKit|KHTML/i.test(navigator.userAgent))
{
var t = setInterval(function() {
if(/loaded|complete/.test(document.readyState))
{
clearInterval(t);tt_HideSrcTags();}
}, 10);}
}
function tt_HideSrcTags()
{
if(!window.tt_HideSrcTags || window.tt_HideSrcTags.done)
return;window.tt_HideSrcTags.done = true;if(!tt_HideSrcTagsRecurs(tt_body))
tt_Err("There are HTML elements to be converted to tooltips.\nIf you"
+ " want these HTML elements to be automatically hidden, you"
+ " must edit wz_tooltip.js, and set TagsToTip in the global"
+ " tooltip configuration to true.", true);}
function tt_HideSrcTagsRecurs(dad)
{
var ovr, asT2t;var a = dad.childNodes || dad.children || null;for(var i = a ? a.length : 0; i;)
{--i;if(!tt_HideSrcTagsRecurs(a[i]))
return false;ovr = a[i].getAttribute ? (a[i].getAttribute("onmouseover") || a[i].getAttribute("onclick"))
: (typeof a[i].onmouseover == "function") ? (a[i].onmouseover || a[i].onclick)
: null;if(ovr)
{
asT2t = ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);if(asT2t && asT2t.length)
{
if(!tt_HideSrcTag(asT2t[0]))
return false;}
}
}
return true;}
function tt_HideSrcTag(sT2t)
{
var id, el;id = sT2t.replace(/.+'([^'.]+)'.+/, "$1");el = tt_GetElt(id);if(el)
{
if(tt_Debug && !TagsToTip)
return false;else
el.style.display = "none";}
else
tt_Err("Invalid ID\n'" + id + "'\npassed to TagToTip()."
+ " There exists no HTML element with that ID.", true);return true;}
function tt_Tip(arg, t2t)
{
if(!tt_db)
return;if(tt_iState)
tt_Hide();if(!tt_Enabled)
return;tt_t2t = t2t;if(!tt_ReadCmds(arg))
return;tt_iState = 0x1 | 0x4;tt_AdaptConfig1();tt_MkTipContent(arg);tt_MkTipSubDivs();tt_FormatTip();tt_bJmpVert = false;tt_bJmpHorz = false;tt_maxPosX = tt_GetClientW() + tt_scrlX - tt_w - 1;tt_maxPosY = tt_GetClientH() + tt_scrlY - tt_h - 1;tt_AdaptConfig2();tt_OverInit();tt_ShowInit();tt_Move();}
function tt_ReadCmds(a)
{
var i;i = 0;for(var j in config)
tt_aV[i++] = config[j];if(a.length & 1)
{
for(i = a.length - 1; i > 0; i -= 2)
tt_aV[a[i - 1]] = a[i];return true;}
tt_Err("Incorrect call of Tip() or TagToTip().\n"
+ "Each command must be followed by a value.", true);return false;}
function tt_AdaptConfig1()
{
tt_ExtCallFncs(0, "LoadConfig");if(!tt_aV[TITLEBGCOLOR].length)
tt_aV[TITLEBGCOLOR] = tt_aV[BORDERCOLOR];if(!tt_aV[TITLEFONTCOLOR].length)
tt_aV[TITLEFONTCOLOR] = tt_aV[BGCOLOR];if(!tt_aV[TITLEFONTFACE].length)
tt_aV[TITLEFONTFACE] = tt_aV[FONTFACE];if(!tt_aV[TITLEFONTSIZE].length)
tt_aV[TITLEFONTSIZE] = tt_aV[FONTSIZE];if(tt_aV[CLOSEBTN])
{
if(!tt_aV[CLOSEBTNCOLORS])
tt_aV[CLOSEBTNCOLORS] = new Array("", "", "", "");for(var i = 4; i;)
{--i;if(!tt_aV[CLOSEBTNCOLORS][i].length)
tt_aV[CLOSEBTNCOLORS][i] = (i & 1) ? tt_aV[TITLEFONTCOLOR] : tt_aV[TITLEBGCOLOR];}
if(!tt_aV[TITLE].length)
tt_aV[TITLE] = " ";}
if(tt_aV[OPACITY] == 100 && typeof tt_aElt[0].style.MozOpacity != tt_u && !Array.every)
tt_aV[OPACITY] = 99;if(tt_aV[FADEIN] && tt_flagOpa && tt_aV[DELAY] > 100)
tt_aV[DELAY] = Math.max(tt_aV[DELAY] - tt_aV[FADEIN], 100);}
function tt_AdaptConfig2()
{
if(tt_aV[CENTERMOUSE])
{
tt_aV[OFFSETX] -= ((tt_w - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0)) >> 1);tt_aV[JUMPHORZ] = false;}
}
function tt_MkTipContent(a)
{
if(tt_t2t)
{
if(tt_aV[COPYCONTENT])
tt_sContent = tt_t2t.innerHTML;else
tt_sContent = "";}
else
tt_sContent = a[0];tt_ExtCallFncs(0, "CreateContentString");}
function tt_MkTipSubDivs()
{
var sCss = 'position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',
sTbTrTd = ' cellspacing="0" cellpadding="0" border="0" style="' + sCss + '"><tbody style="' + sCss + '"><tr><td ';tt_aElt[0].innerHTML =
(''
+ (tt_aV[TITLE].length ?
('<div id="WzTiTl" style="position:relative;z-index:1;">'
+ '<table id="WzTiTlTb"' + sTbTrTd + 'id="WzTiTlI" style="' + sCss + '">'
+ tt_aV[TITLE]
+ '</td>'
+ (tt_aV[CLOSEBTN] ?
('<td align="right" style="' + sCss
+ 'text-align:right;">'
+ '<span id="WzClOsE" style="padding-left:2px;padding-right:2px;'
+ 'cursor:' + (tt_ie ? 'hand' : 'pointer')
+ ';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">'
+ tt_aV[CLOSEBTNTEXT]
+ '</span></td>')
: '')
+ '</tr></tbody></table></div>')
: '')
+ '<div id="WzBoDy" style="position:relative;z-index:0;">'
+ '<table' + sTbTrTd + 'id="WzBoDyI" style="' + sCss + '">'
+ tt_sContent
+ '</td></tr></tbody></table></div>'
+ (tt_aV[SHADOW]
? ('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
+ '<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>')
: '')
);tt_GetSubDivRefs();if(tt_t2t && !tt_aV[COPYCONTENT])
{
tt_t2tDad = tt_t2t.parentNode || tt_t2t.parentElement || tt_t2t.offsetParent || null;if(tt_t2tDad)
{
tt_MovDomNode(tt_t2t, tt_t2tDad, tt_aElt[6]);tt_t2t.style.display = "block";}
}
tt_ExtCallFncs(0, "SubDivsCreated");}
function tt_GetSubDivRefs()
{
var aId = new Array("WzTiTl", "WzTiTlTb", "WzTiTlI", "WzClOsE", "WzBoDy", "WzBoDyI", "WzTtShDwB", "WzTtShDwR");for(var i = aId.length; i; --i)
tt_aElt[i] = tt_GetElt(aId[i - 1]);}
function tt_FormatTip()
{
var css, w, h, iOffY, iOffSh,
iAdd = (tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1;if(tt_aV[TITLE].length)
{
css = tt_aElt[1].style;css.background = tt_aV[TITLEBGCOLOR];css.paddingTop = (tt_aV[CLOSEBTN] ? 2 : 0) + "px";css.paddingBottom = "1px";css.paddingLeft = css.paddingRight = tt_aV[PADDING] + "px";css = tt_aElt[3].style;css.color = tt_aV[TITLEFONTCOLOR];if (tt_aV[WIDTH] == -1)
css.whiteSpace = "nowrap";css.fontFamily = tt_aV[TITLEFONTFACE];css.fontSize = tt_aV[TITLEFONTSIZE];css.fontWeight = "bold";css.textAlign = tt_aV[TITLEALIGN];if(tt_aElt[4])
{
css.paddingRight = (tt_aV[PADDING] << 1) + "px";css = tt_aElt[4].style;css.background = tt_aV[CLOSEBTNCOLORS][0];css.color = tt_aV[CLOSEBTNCOLORS][1];css.fontFamily = tt_aV[TITLEFONTFACE];css.fontSize = tt_aV[TITLEFONTSIZE];css.fontWeight = "bold";}
if(tt_aV[WIDTH] > 0)
tt_w = tt_aV[WIDTH];else
{
tt_w = tt_GetDivW(tt_aElt[3]) + tt_GetDivW(tt_aElt[4]);if(tt_aElt[4])
tt_w += tt_aV[PADDING];if(tt_aV[WIDTH] < -1 && tt_w > -tt_aV[WIDTH])
tt_w = -tt_aV[WIDTH];}
iOffY = -tt_aV[BORDERWIDTH];}
else
{
tt_w = 0;iOffY = 0;}
css = tt_aElt[5].style;css.top = iOffY + "px";if(tt_aV[BORDERWIDTH])
{
css.borderColor = tt_aV[BORDERCOLOR];css.borderStyle = tt_aV[BORDERSTYLE];css.borderWidth = tt_aV[BORDERWIDTH] + "px";}
if(tt_aV[BGCOLOR].length)
css.background = tt_aV[BGCOLOR];if(tt_aV[BGIMG].length)
css.backgroundImage = "url(" + tt_aV[BGIMG] + ")";css.padding = tt_aV[PADDING] + "px";css.textAlign = tt_aV[TEXTALIGN];if(tt_aV[HEIGHT])
{
css.overflow = "auto";if(tt_aV[HEIGHT] > 0)
css.height = (tt_aV[HEIGHT] + iAdd) + "px";else
tt_h = iAdd - tt_aV[HEIGHT];}
css = tt_aElt[6].style;css.color = tt_aV[FONTCOLOR];css.fontFamily = tt_aV[FONTFACE];css.fontSize = tt_aV[FONTSIZE];css.fontWeight = tt_aV[FONTWEIGHT];css.background = "";css.textAlign = tt_aV[TEXTALIGN];if(tt_aV[WIDTH] > 0)
w = tt_aV[WIDTH];else if(tt_aV[WIDTH] == -1 && tt_w)
w = tt_w;else
{
w = tt_GetDivW(tt_aElt[6]);if(tt_aV[WIDTH] < -1 && w > -tt_aV[WIDTH])
w = -tt_aV[WIDTH];}
if(w > tt_w)
tt_w = w;tt_w += iAdd;if(tt_aV[SHADOW])
{
tt_w += tt_aV[SHADOWWIDTH];iOffSh = Math.floor((tt_aV[SHADOWWIDTH] * 4) / 3);css = tt_aElt[7].style;css.top = iOffY + "px";css.left = iOffSh + "px";css.width = (tt_w - iOffSh - tt_aV[SHADOWWIDTH]) + "px";css.height = tt_aV[SHADOWWIDTH] + "px";css.background = tt_aV[SHADOWCOLOR];css = tt_aElt[8].style;css.top = iOffSh + "px";css.left = (tt_w - tt_aV[SHADOWWIDTH]) + "px";css.width = tt_aV[SHADOWWIDTH] + "px";css.background = tt_aV[SHADOWCOLOR];}
else
iOffSh = 0;tt_SetTipOpa(tt_aV[FADEIN] ? 0 : tt_aV[OPACITY]);tt_FixSize(iOffY, iOffSh);}
function tt_FixSize(iOffY, iOffSh)
{
var wIn, wOut, h, add, i;tt_aElt[0].style.width = tt_w + "px";tt_aElt[0].style.pixelWidth = tt_w;wOut = tt_w - ((tt_aV[SHADOW]) ? tt_aV[SHADOWWIDTH] : 0);wIn = wOut;if(!tt_bBoxOld)
wIn -= (tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1;tt_aElt[5].style.width = wIn + "px";if(tt_aElt[1])
{
wIn = wOut - (tt_aV[PADDING] << 1);if(!tt_bBoxOld)
wOut = wIn;tt_aElt[1].style.width = wOut + "px";tt_aElt[2].style.width = wIn + "px";}
if(tt_h)
{
h = tt_GetDivH(tt_aElt[5]);if(h > tt_h)
{
if(!tt_bBoxOld)
tt_h -= (tt_aV[PADDING] + tt_aV[BORDERWIDTH]) << 1;tt_aElt[5].style.height = tt_h + "px";}
}
tt_h = tt_GetDivH(tt_aElt[0]) + iOffY;if(tt_aElt[8])
tt_aElt[8].style.height = (tt_h - iOffSh) + "px";i = tt_aElt.length - 1;if(tt_aElt[i])
{
tt_aElt[i].style.width = tt_w + "px";tt_aElt[i].style.height = tt_h + "px";}
}
function tt_DeAlt(el)
{
var aKid;if(el)
{
if(el.alt)
el.alt = "";if(el.title)
el.title = "";aKid = el.childNodes || el.children || null;if(aKid)
{
for(var i = aKid.length; i;)
tt_DeAlt(aKid[--i]);}
}
}
function tt_OpDeHref(el)
{
if(!tt_op)
return;if(tt_elDeHref)
tt_OpReHref();while(el)
{
if(el.hasAttribute("href"))
{
el.t_href = el.getAttribute("href");el.t_stats = window.status;el.removeAttribute("href");el.style.cursor = "hand";tt_AddEvtFnc(el, "mousedown", tt_OpReHref);window.status = el.t_href;tt_elDeHref = el;break;}
el = el.parentElement;}
}
function tt_OpReHref()
{
if(tt_elDeHref)
{
tt_elDeHref.setAttribute("href", tt_elDeHref.t_href);tt_RemEvtFnc(tt_elDeHref, "mousedown", tt_OpReHref);window.status = tt_elDeHref.t_stats;tt_elDeHref = null;}
}
function tt_OverInit()
{
if(window.event)
tt_over = window.event.target || window.event.srcElement;else
tt_over = tt_ovr_;tt_DeAlt(tt_over);tt_OpDeHref(tt_over);}
function tt_ShowInit()
{
tt_tShow.Timer("tt_Show()", tt_aV[DELAY], true);if(tt_aV[CLICKCLOSE] || tt_aV[CLICKSTICKY])
tt_AddEvtFnc(document, "mouseup", tt_OnLClick);}
function tt_Show()
{
var css = tt_aElt[0].style;css.zIndex = Math.max((window.dd && dd.z) ? (dd.z + 2) : 0, 1010);if(tt_aV[STICKY] || !tt_aV[FOLLOWMOUSE])
tt_iState &= ~0x4;if(tt_aV[DURATION] > 0)
tt_tDurt.Timer("tt_HideInit()", tt_aV[DURATION], true);tt_ExtCallFncs(0, "Show")
css.visibility = "visible";tt_iState |= 0x2;if(tt_aV[FADEIN])
tt_Fade(0, 0, tt_aV[OPACITY], Math.round(tt_aV[FADEIN] / tt_aV[FADEINTERVAL]));tt_ShowIfrm();}
function tt_ShowIfrm()
{
if(tt_ie56)
{
var ifrm = tt_aElt[tt_aElt.length - 1];if(ifrm)
{
var css = ifrm.style;css.zIndex = tt_aElt[0].style.zIndex - 1;css.display = "block";}
}
}
function tt_Move(e)
{
if(e)
tt_ovr_ = e.target || e.srcElement;e = e || window.event;if(e)
{
tt_musX = tt_GetEvtX(e);tt_musY = tt_GetEvtY(e);}
if(tt_iState & 0x04)
{
if(!tt_op && !tt_ie)
{
if(tt_bWait)
return;tt_bWait = true;tt_tWaitMov.Timer("tt_bWait = false;", 1, true);}
if(tt_aV[FIX])
{
var iY = tt_aV[FIX][1];if(tt_aV[ABOVE])
iY -= tt_h;tt_iState &= ~0x4;tt_SetTipPos(tt_aV[FIX][0], tt_aV[FIX][1]);}
else if(!tt_ExtCallFncs(e, "MoveBefore"))
tt_SetTipPos(tt_Pos(0), tt_Pos(1));tt_ExtCallFncs([tt_musX, tt_musY], "MoveAfter")
}
}
function tt_Pos(iDim)
{
var iX, bJmpMode, cmdAlt, cmdOff, cx, iMax, iScrl, iMus, bJmp;if(iDim)
{
bJmpMode = tt_aV[JUMPVERT];cmdAlt = ABOVE;cmdOff = OFFSETY;cx = tt_h;iMax = tt_maxPosY;iScrl = tt_scrlY;iMus = tt_musY;bJmp = tt_bJmpVert;}
else
{
bJmpMode = tt_aV[JUMPHORZ];cmdAlt = LEFT;cmdOff = OFFSETX;cx = tt_w;iMax = tt_maxPosX;iScrl = tt_scrlX;iMus = tt_musX;bJmp = tt_bJmpHorz;}
if(bJmpMode)
{
if(tt_aV[cmdAlt] && (!bJmp || tt_CalcPosAlt(iDim) >= iScrl + 16))
iX = tt_PosAlt(iDim);else if(!tt_aV[cmdAlt] && bJmp && tt_CalcPosDef(iDim) > iMax - 16)
iX = tt_PosAlt(iDim);else
iX = tt_PosDef(iDim);}
else
{
iX = iMus;if(tt_aV[cmdAlt])
iX -= cx + tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);else
iX += tt_aV[cmdOff];}
if(iX > iMax)
iX = bJmpMode ? tt_PosAlt(iDim) : iMax;if(iX < iScrl)
iX = bJmpMode ? tt_PosDef(iDim) : iScrl;return iX;}
function tt_PosDef(iDim)
{
if(iDim)
tt_bJmpVert = tt_aV[ABOVE];else
tt_bJmpHorz = tt_aV[LEFT];return tt_CalcPosDef(iDim);}
function tt_PosAlt(iDim)
{
if(iDim)
tt_bJmpVert = !tt_aV[ABOVE];else
tt_bJmpHorz = !tt_aV[LEFT];return tt_CalcPosAlt(iDim);}
function tt_CalcPosDef(iDim)
{
return iDim ? (tt_musY + tt_aV[OFFSETY]) : (tt_musX + tt_aV[OFFSETX]);}
function tt_CalcPosAlt(iDim)
{
var cmdOff = iDim ? OFFSETY : OFFSETX;var dx = tt_aV[cmdOff] - (tt_aV[SHADOW] ? tt_aV[SHADOWWIDTH] : 0);if(tt_aV[cmdOff] > 0 && dx <= 0)
dx = 1;return((iDim ? (tt_musY - tt_h) : (tt_musX - tt_w)) - dx);}
function tt_Fade(a, now, z, n)
{
if(n)
{
now += Math.round((z - now) / n);if((z > a) ? (now >= z) : (now <= z))
now = z;else
tt_tFade.Timer("tt_Fade("
+ a + "," + now + "," + z + "," + (n - 1)
+ ")",
tt_aV[FADEINTERVAL],
true);}
now ? tt_SetTipOpa(now) : tt_Hide();}
function tt_SetTipOpa(opa)
{
tt_SetOpa(tt_aElt[5], opa);if(tt_aElt[1])
tt_SetOpa(tt_aElt[1], opa);if(tt_aV[SHADOW])
{
opa = Math.round(opa * 0.8);tt_SetOpa(tt_aElt[7], opa);tt_SetOpa(tt_aElt[8], opa);}
}
function tt_OnScrl()
{
tt_scrlX = tt_GetScrollX();tt_scrlY = tt_GetScrollY();}
function tt_OnCloseBtnOver(iOver)
{
var css = tt_aElt[4].style;iOver <<= 1;css.background = tt_aV[CLOSEBTNCOLORS][iOver];css.color = tt_aV[CLOSEBTNCOLORS][iOver + 1];}
function tt_OnLClick(e)
{
e = e || window.event;if(!((e.button && e.button & 2) || (e.which && e.which == 3)))
{
if(tt_aV[CLICKSTICKY] && (tt_iState & 0x4))
{
tt_aV[STICKY] = true;tt_iState &= ~0x4;}
else if(tt_aV[CLICKCLOSE])
tt_HideInit();}
}
function tt_Int(x)
{
var y;return(isNaN(y = parseInt(x)) ? 0 : y);}
Number.prototype.Timer = function(s, iT, bUrge)
{
if(!this.value || bUrge)
this.value = window.setTimeout(s, iT);}
Number.prototype.EndTimer = function()
{
if(this.value)
{
window.clearTimeout(this.value);this.value = 0;}
}
function tt_SetOpa(el, opa)
{
var css = el.style;tt_opa = opa;if(tt_flagOpa == 1)
{
if(opa < 100)
{
if(typeof(el.filtNo) == tt_u)
el.filtNo = css.filter;var bVis = css.visibility != "hidden";css.zoom = "100%";if(!bVis)
css.visibility = "visible";css.filter = "alpha(opacity=" + opa + ")";if(!bVis)
css.visibility = "hidden";}
else if(typeof(el.filtNo) != tt_u)
css.filter = el.filtNo;}
else
{
opa /= 100.0;switch(tt_flagOpa)
{
case 2:
css.KhtmlOpacity = opa; break;case 3:
css.KHTMLOpacity = opa; break;case 4:
css.MozOpacity = opa; break;case 5:
css.opacity = opa; break;}
}
}
function tt_MovDomNode(el, dadFrom, dadTo)
{
if(dadFrom)
dadFrom.removeChild(el);if(dadTo)
dadTo.appendChild(el);}
function tt_Err(sErr, bIfDebug)
{
if(tt_Debug || !bIfDebug)
alert("Tooltip Script Error Message:\n\n" + sErr);}
function tt_ExtCmdEnum()
{
var s;for(var i in config)
{
s = "window." + i.toString().toUpperCase();if(eval("typeof(" + s + ") == tt_u"))
{
eval(s + " = " + tt_aV.length);tt_aV[tt_aV.length] = null;}
}
}
function tt_ExtCallFncs(arg, sFnc)
{
var b = false;for(var i = tt_aExt.length; i;)
{--i;var fnc = tt_aExt[i]["On" + sFnc];if(fnc && fnc(arg))
b = true;}
return b;}
tt_Init();/*
tip_balloon.js  v. 1.5
The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de
Initial author: Walter Zorn
Last modified: 11.4.2008
Extension for the tooltip library wz_tooltip.js.
Implements balloon tooltips.
*/
config. Balloon				= true	// true or false - set to true if you want this to be the default behaviour
config. BalloonImgPath		= "/images/tip/" // Path to images (border, corners, stem), in quotes. Path must be relative to your HTML file.
config. BalloonEdgeSize		= 6		// Integer - sidelength of quadratic corner images
config. BalloonStemWidth	= 15	// Integer
config. BalloonStemHeight	= 19	// Integer
config. BalloonStemOffset	= -7	// Integer - horizontal offset of left stem edge from mouse (recommended: -stemwidth/2 to center the stem above the mouse)
var balloon = new tt_Extension();balloon.OnLoadConfig = function()
{
if(tt_aV[BALLOON])
{
balloon.padding = Math.max(tt_aV[PADDING] - tt_aV[BALLOONEDGESIZE], 0);balloon.width = tt_aV[WIDTH];tt_aV[BORDERWIDTH] = 0;tt_aV[WIDTH] = 0;tt_aV[PADDING] = 0;tt_aV[BGCOLOR] = "";tt_aV[BGIMG] = "";tt_aV[SHADOW] = false;if(tt_aV[BALLOONIMGPATH].charAt(tt_aV[BALLOONIMGPATH].length - 1) != '/')
tt_aV[BALLOONIMGPATH] += "/";return true;}
return false;};balloon.OnCreateContentString = function()
{
if(!tt_aV[BALLOON])
return false;var aImg, sImgZ, sCssCrn, sVaT, sVaB, sCssImg;if(tt_aV[BALLOONIMGPATH] == config.BalloonImgPath)
aImg = balloon.aDefImg;else
aImg = Balloon_CacheImgs(tt_aV[BALLOONIMGPATH]);sCssCrn = ' style="position:relative;width:' + tt_aV[BALLOONEDGESIZE] + 'px;padding:0px;margin:0px;overflow:hidden;line-height:0px;';sVaT = 'vertical-align:top;" valign="top"';sVaB = 'vertical-align:bottom;" valign="bottom"';sCssImg = 'padding:0px;margin:0px;border:0px;';sImgZ = '" style="' + sCssImg + '" />';tt_sContent = '<table border="0" cellpadding="0" cellspacing="0" style="width:auto;padding:0px;margin:0px;left:0px;top:0px;"><tr>'
+ '<td' + sCssCrn + sVaB + '>'
+ '<img src="' + aImg[1].src + '" width="' + tt_aV[BALLOONEDGESIZE] + '" height="' + tt_aV[BALLOONEDGESIZE] + sImgZ
+ '</td>'
+ '<td valign="bottom" style="position:relative;padding:0px;margin:0px;overflow:hidden;">'
+ '<img id="bALlOOnT" style="position:relative;top:1px;z-index:1;display:none;' + sCssImg + '" src="' + aImg[9].src + '" width="' + tt_aV[BALLOONSTEMWIDTH] + '" height="' + tt_aV[BALLOONSTEMHEIGHT] + '" />'
+ '<div style="position:relative;z-index:0;padding:0px;margin:0px;overflow:hidden;width:auto;height:' + tt_aV[BALLOONEDGESIZE] + 'px;background-image:url(' + aImg[2].src + ');">'
+ '</div>'
+ '</td>'
+ '<td' + sCssCrn + sVaB + '>'
+ '<img src="' + aImg[3].src + '" width="' + tt_aV[BALLOONEDGESIZE] + '" height="' + tt_aV[BALLOONEDGESIZE] + sImgZ
+ '</td>'
+ '</tr><tr>'
+ '<td style="position:relative;padding:0px;margin:0px;width:' + tt_aV[BALLOONEDGESIZE] + 'px;overflow:hidden;background-image:url(' + aImg[8].src + ');">'
+ '<img width="' + tt_aV[BALLOONEDGESIZE] + '" height="100%" src="' + aImg[8].src + sImgZ
+ '</td>'
+ '<td id="bALlO0nBdY" style="position:relative;line-height:normal;'
+ ';background-image:url(' + aImg[0].src + ')'
+ ';color:' + tt_aV[FONTCOLOR]
+ ';font-family:' + tt_aV[FONTFACE]
+ ';font-size:' + tt_aV[FONTSIZE]
+ ';font-weight:' + tt_aV[FONTWEIGHT]
+ ';text-align:' + tt_aV[TEXTALIGN]
+ ';padding:' + balloon.padding + 'px'
+ ';width:' + ((balloon.width > 0) ? (balloon.width + 'px') : 'auto')
+ ';">' + tt_sContent + '</td>'
+ '<td style="position:relative;padding:0px;margin:0px;width:' + tt_aV[BALLOONEDGESIZE] + 'px;overflow:hidden;background-image:url(' + aImg[4].src + ');">'
+ '<img width="' + tt_aV[BALLOONEDGESIZE] + '" height="100%" src="' + aImg[4].src + sImgZ
+ '</td>'
+ '</tr><tr>'
+ '<td' + sCssCrn + sVaT + '>'
+ '<img src="' + aImg[7].src + '" width="' + tt_aV[BALLOONEDGESIZE] + '" height="' + tt_aV[BALLOONEDGESIZE] + sImgZ
+ '</td>'
+ '<td valign="top" style="position:relative;padding:0px;margin:0px;overflow:hidden;">'
+ '<div style="position:relative;left:0px;top:0px;padding:0px;margin:0px;overflow:hidden;width:auto;height:' + tt_aV[BALLOONEDGESIZE] + 'px;background-image:url(' + aImg[6].src + ');"></div>'
+ '<img id="bALlOOnB" style="position:relative;top:-1px;left:2px;z-index:1;display:none;' + sCssImg + '" src="' + aImg[10].src + '" width="' + tt_aV[BALLOONSTEMWIDTH] + '" height="' + tt_aV[BALLOONSTEMHEIGHT] + '" />'
+ '</td>'
+ '<td' + sCssCrn + sVaT + '>'
+ '<img src="' + aImg[5].src + '" width="' + tt_aV[BALLOONEDGESIZE] + '" height="' + tt_aV[BALLOONEDGESIZE] + sImgZ
+ '</td>'
+ '</tr></table>';return true;};balloon.OnSubDivsCreated = function()
{
if(tt_aV[BALLOON])
{
balloon.iStem = tt_aV[ABOVE] * 1;balloon.aStem = [tt_GetElt("bALlOOnT"), tt_GetElt("bALlOOnB")];balloon.aStem[balloon.iStem].style.display = "inline";if (balloon.width < -1)
Balloon_MaxW();return true;}
return false;};balloon.OnMoveAfter = function()
{
if(tt_aV[BALLOON])
{
var iStem = (tt_aV[ABOVE] != tt_bJmpVert) * 1;if(iStem != balloon.iStem)
{
balloon.aStem[balloon.iStem].style.display = "none";balloon.aStem[iStem].style.display = "inline";balloon.iStem = iStem;}
balloon.aStem[iStem].style.left = Balloon_CalcStemX() + "px";return true;}
return false;};function Balloon_CalcStemX()
{
var x = tt_musX - tt_x + tt_aV[BALLOONSTEMOFFSET] - tt_aV[BALLOONEDGESIZE];return Math.max(Math.min(x, tt_w - tt_aV[BALLOONSTEMWIDTH] - (tt_aV[BALLOONEDGESIZE] << 1) - 2), 2);}
function Balloon_CacheImgs(sPath)
{
var asImg = ["background", "lt", "t", "rt", "r", "rb", "b", "lb", "l", "stemt", "stemb"],
n = asImg.length,
aImg = new Array(n),
img;while(n)
{--n;img = aImg[n] = new Image();img.src = sPath + asImg[n] + ".gif";  //  Change to ".png" if you want to use PNG images
}
return aImg;}
function Balloon_MaxW()
{
var bdy = tt_GetElt("bALlO0nBdY");if (bdy)
{
var iAdd = tt_bBoxOld ? (balloon.padding << 1) : 0, w = tt_GetDivW(bdy);if (w > -balloon.width + iAdd)
bdy.style.width = (-balloon.width + iAdd) + "px";}
}
function Balloon_PreCacheDefImgs()
{
if(config.BalloonImgPath.charAt(config.BalloonImgPath.length - 1) != '/')
config.BalloonImgPath += "/";balloon.aDefImg = Balloon_CacheImgs(config.BalloonImgPath);}
Balloon_PreCacheDefImgs();_Widget = function(element, Tab)
{
this.obj = element;if (this.obj.Icon && this.obj.Icon.length > 0)
{
}
else
{
this.obj.Icon = "/widgets/default.gif";}
this.id = element.id;this.loaded = false;this.Tab = Tab;this.code = "";}
_Widget.prototype =
{
ToString: function() {
var str = "";str += "id : " + this.id + "\n";str += "loaded : " + this.loaded + "\n";str += "Tab : " + this.Tab + "\n";str += "obj.id : " + this.obj.id + "\n";str += "obj.ColumnNo : " + this.obj.ColumnNo + "\n";str += "obj.OrderNo : " + this.obj.OrderNo + "\n";str += "obj.Expanded : " + this.obj.Expanded + "\n";str += "obj.Title : " + this.obj.Title + "\n";str += "obj.URL : " + this.obj.URL + "\n";str += "obj.Icon : " + this.obj.Icon + "\n";str += "obj.State : " + this.obj.State + "\n";str += "Tab.Element_Widgets : " + this.Tab.Element_Widgets.id + "\n";str += "Tab.Element_Cell1 : " + this.Tab.Element_Cell1.id + "\n";str += "Tab.Element_Cell2 : " + this.Tab.Element_Cell2.id + "\n";str += "Tab.Element_Cell3 : " + this.Tab.Element_Cell3.id + "\n";if (this.Tab.Element_Cell4)
str += "Tab.Element_Cell4 : " + this.Tab.Element_Cell4.id + "\n";str += "Instance : " + this.instance + "\n";str += "Height : " + this.obj.Height + "\n";return str;},
RenderWidget: function(content) {
WriteHistory("RenderWidget: " + this.id + ":" + this.obj.Title);var xmlDoc = null;try //Internet Explorer
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async = false;xmlDoc.loadXML(content);}
catch (e) {
try //Firefox, Mozilla, Opera, etc.
{
parser = new DOMParser();xmlDoc = parser.parseFromString(content, "text/xml");}
catch (e) { alert(e.message) }
}
if (xmlDoc.childNodes.length > 0) {
this.src = xmlDoc.getElementsByTagName("Script")[0].firstChild.nodeValue;installScriptSrc(this.src);grabContent(xmlDoc.getElementsByTagName("Content")[0].firstChild.nodeValue + "?id=" + this.id, Function.createDelegate(this, this.onContentLoad));this.code = "var W{0}=myTabs.FindTab(" + this.Tab.id + ").FindWidget({0});";this.code += xmlDoc.getElementsByTagName("Initialization")[0].firstChild.nodeValue;this.code = this.code.replace(/\{0\}/g, this.id);}
xmlDoc = null;},
onContentLoad: function(content) {
this.HTML = content;WriteHistory("<hr>Widget " + this.id + '<br>' + this.HTML + "<hr>");this.DoLoad();},
DoLoad: function() {
WriteHistory("DoLoad: " + this.id);if (installScriptSrc_CheckLoaded(this.src)) {
installScript(this.code);}
else {
if (this.DoLoad_Idx)
this.DoLoad_Idx++;else
this.DoLoad_Idx = 1;if (this.DoLoad_Idx < 10)
setTimeout(Function.createDelegate(this, this.DoLoad), 1000);}
},
Delete: function(instance) {
if (myTabs.hasRequiredTabPermission(this.Tab, TabAccessLevel.Widget_Delete)) {
if (confirm("Are you sure you want to delete the " + this.obj.Title.replace("\"", "\\\"") + " widget?")) {
instance.WidgetDiv.parentNode.removeChild(instance.WidgetDiv);var col = this.obj.ColumnNo;var Widgets = this.Tab.Widgets;var spliceIdx = -1;var OrderStr = "";for (var i = 0; i < Widgets.length; i++) {
if (Widgets[i].obj.ColumnNo == col) {
if (Widgets[i].id == this.id) {
spliceIdx = i;}
else if (Widgets[i].obj.OrderNo > this.obj.OrderNo) {
Widgets[i].obj.OrderNo = Widgets[i].obj.OrderNo - 1;}
}
}
WriteHistory("Delete: " + spliceIdx + ":");if (spliceIdx > -1) {
Widgets.splice(i, 1);myWidgets.RemoveWidgetInstance(instance.id);instance = null;}
JSON.Widget_Delete(this.Tab.id, this.id, myTabs.ReloadCurrentTab);}
}
else {
alert("You do not have the permission to delete this widget");}
},
InstanceEdit: function(objToFocus, WidgetDiv_BodySettings, WidgetDiv_BodyContent, WidgetDiv_Command_Edit) {
if (myTabs.hasRequiredTabPermission(this.Tab, TabAccessLevel.Widget_Edit)) {
if (!WidgetDiv_BodyContent)
WidgetDiv_BodyContent = this.instance.WidgetDiv_BodyContent;if (!WidgetDiv_BodySettings)
WidgetDiv_BodySettings = this.instance.WidgetDiv_BodySettings;if (!WidgetDiv_Command_Edit)
WidgetDiv_Command_Edit = this.instance.WidgetDiv_Command_Edit;WidgetDiv_BodySettings.style.display = "none";WidgetDiv_BodyContent.style.display = "none";if (this.instance.inEditMode) {
WidgetDiv_BodyContent.style.display = "";WidgetDiv_Command_Edit.innerHTML = "Edit Widget Properties";}
else {
WidgetDiv_BodySettings.style.display = "";WidgetDiv_Command_Edit.innerHTML = "Cancel Edit";}
this.instance.inEditMode = !this.instance.inEditMode;if (objToFocus)
$show(objToFocus, "IGNORE", true);}
else {
alert("You do not have permission to edit the widget properties");}
},
InstanceLoad: function() {
WriteHistory("InstanceLoad:" + this.id + ":" + this.obj.Title);var RenderInColumn = null;switch (this.obj.ColumnNo) {
case 2:
RenderInColumn = this.Tab.Element_Cell2;if (RenderInColumn == null)
return;break;case 3:
RenderInColumn = this.Tab.Element_Cell3;if (RenderInColumn == null)
return;break;case 4:
RenderInColumn = this.Tab.Element_Cell4;if (RenderInColumn == null)
return;break;default:
RenderInColumn = this.Tab.Element_Cell1;break;}
var WidgetDiv = document.createElement("div");WidgetDiv.className = "widget";WidgetDiv.id = "wdiv_" + this.id;var theContent = this.HTML.replace(/\{0\}/g, this.id).replace("[img]", this.obj.Icon).replace("[title]", this.obj.Title);var idx_Menu = theContent.indexOf("<!-- MENU -->");var theMenu = theContent.substring(idx_Menu);var theContent = theContent.substring(0, idx_Menu);WidgetDiv.innerHTML = theContent;/*
Need to render in the correct order
to do that, i need to search the tab -> which takes very long
so do a hack, use myWidgets.GetWidgetInstance(id)
wdiv_xxx
RenderInColumn would have childnodes, so i loop thru renderincolumn childnodes,
get the matching order then insert accordingly
*/
if (RenderInColumn.childNodes.length < 1) {
RenderInColumn.appendChild(WidgetDiv);}
else {
var Inserted = false;for (var i = 0; i < RenderInColumn.childNodes.length && !Inserted; i++) {
var theDivId = RenderInColumn.childNodes[i].id;if (theDivId.length > 5) {
var WidgetInstanceID = parseInt(theDivId.substring(5));if (WidgetInstanceID > 0) {
var theWidgetInstance = $WI(WidgetInstanceID);if (theWidgetInstance) {
if (this.obj.OrderNo < theWidgetInstance.Widget.obj.OrderNo) {
RenderInColumn.insertBefore(WidgetDiv, RenderInColumn.childNodes[i]);Inserted = true;break;}
}
else {
WriteHistory("Cannot find Widget Instance");}
}
}
}
if (!Inserted)
RenderInColumn.appendChild(WidgetDiv);}
/*
if (RenderInColumn.childNodes.length <= this.obj.OrderNo)
{
RenderInColumn.appendChild(WidgetDiv);}
else
{
RenderInColumn.insertBefore(WidgetDiv, RenderInColumn.childNodes[this.obj.OrderNo-1]);}
*/
var theMenuNode = document.createElement("div");theMenuNode.id = "WTab_" + this.Tab.id + "_" + this.id;theMenuNode.innerHTML = theMenu;div_Widgets.appendChild(theMenuNode);var MenuElements = theMenuNode.getElementsByTagName("LI");WriteHistory("MenuElements: " + MenuElements.length);for (var i = 0; i < MenuElements.length; i++) {
var found = false;if (this.instance.Menu_Edit) {
for (var j = 0; j < this.instance.Menu_Edit.length; j++) {
WriteHistory("Compare:" + this.instance.Menu_Edit[j] + " : " + MenuElements[i].id);if (this.instance.Menu_Edit[j] == MenuElements[i].id) {
found = true;if (!this.Tab.hasRequiredTabPermission(TabAccessLevel.Widget_Edit)) {
MenuElements[i].style.display = "none";}
}
}
}
if (!found) {
if (MenuElements[i].childNodes && MenuElements[i].childNodes.length > 0 && MenuElements[i].childNodes[0].onclick) {
var onClickCmd = MenuElements[i].childNodes[0].onclick.toString().toLowerCase();WriteHistory("MenuElements #" + i + "<br>" + onClickCmd);WriteHistory(onClickCmd.indexOf(".titleedit()"));if (onClickCmd.indexOf(".titleedit()") > -1) {
if (!this.Tab.hasRequiredTabPermission(TabAccessLevel.Widget_EditTitle)) {
MenuElements[i].style.display = "none";}
}
else if (onClickCmd.indexOf(".delete()") > -1) {
if (!this.Tab.hasRequiredTabPermission(TabAccessLevel.Widget_Delete)) {
MenuElements[i].style.display = "none";}
}
else if (onClickCmd.indexOf(".edit()") > -1) {
if (!this.Tab.hasRequiredTabPermission(TabAccessLevel.Widget_Edit)) {
MenuElements[i].style.display = "none";}
}
}
}
}
installScript("Menu_AddTarget('wdivcad" + this.id + "','wdivcd" + this.id + "');");this.instance.WidgetDiv_Footer = document.getElementById("wdivf" + this.id);this.instance.WidgetDiv_Footer.className = (this.obj.Expanded ? "widget_footer_collapse" : "widget_footer_expand");this.instance.WidgetDiv = WidgetDiv;this.instance.WidgetDiv_Body = document.getElementById("wdivb" + this.id);if (this.obj.Height > 0) {
this.instance.WidgetDiv_Body.style.height = this.obj.Height + "px";}
if (!this.obj.Expanded)
this.instance.WidgetDiv_Body.style.display = "none";this.instance.WidgetDiv_Header_Lbl = document.getElementById("wdivht" + this.id);this.instance.WidgetDiv_Header_Input = document.getElementById("wdivhi" + this.id);if (myTabs.hasRequiredTabPermission(this.Tab, TabAccessLevel.Widget_EditTitle)) {
var script = "$('" + this.instance.WidgetDiv_Header_Input.id + "').onblur = function(){$WI('" + this.id + "').SaveTitle();};";if (is_ie)
script += "$('" + this.instance.WidgetDiv_Header_Input.id + "').onkeypress = function(){if(event.keyCode==13){$WI('" + this.id + "').SaveTitle();event.keyCode=0;return false;}};";else
script += "$('" + this.instance.WidgetDiv_Header_Input.id + "').onkeypress = function(event){if(event.keyCode==13){$WI('" + this.id + "').SaveTitle();return false;}};";installScript(script);}
},
InstanceLoadComplete: function() {
if (myTabs.hasRequiredTabPermission(this.Tab, TabAccessLevel.Widget_Reorder)) {
myTabs.EnableWidgetDragDrop(this.Tab, this.obj.ColumnNo);}
this.loaded = true;div_WidgetProgress.style.display = "none";WriteHistory("InstanceLoadComplete:" + this.instance.WidgetDiv.id + ":" + this.instance.WidgetDiv.parentNode);this.instance.WidgetDiv = $get(this.instance.WidgetDiv.id);},
InstanceToggleExpand: function(WidgetDiv_Footer, WidgetDiv_Body) {
if (!WidgetDiv_Footer)
WidgetDiv_Footer = this.instance.WidgetDiv_Footer;if (!WidgetDiv_Body)
WidgetDiv_Body = this.instance.WidgetDiv_Body;if (this.obj.Expanded) {
WidgetDiv_Footer.className = "widget_footer_expand";this.obj.Expanded = false;Effect.BlindUp(WidgetDiv_Body);}
else {
WidgetDiv_Footer.className = "widget_footer_collapse";this.obj.Expanded = true;Effect.BlindDown(WidgetDiv_Body);}
if (this.Tab.hasRequiredTabPermission(TabAccessLevel.Widget_Edit)) {
JSON.Widget_UpdateProperty(this.Tab.id, this.id, "Expanded", this.obj.Expanded);}
},
InstanceTitleEdit: function(WidgetDiv_Header_Lbl, WidgetDiv_Header_Input) {
if (myTabs.hasRequiredTabPermission(this.Tab, TabAccessLevel.Widget_Edit)) {
if (!WidgetDiv_Header_Lbl)
WidgetDiv_Header_Lbl = this.instance.WidgetDiv_Header_Lbl;if (!WidgetDiv_Header_Input)
WidgetDiv_Header_Input = this.instance.WidgetDiv_Header_Input;WidgetDiv_Header_Lbl.style.display = "none";WidgetDiv_Header_Input.style.display = "none";if (this.instance.inTitleEditMode) {
WidgetDiv_Header_Lbl.style.display = "";}
else {
WidgetDiv_Header_Input.value = WidgetDiv_Header_Lbl.innerHTML;$show(WidgetDiv_Header_Input.id, "inline", true);}
this.instance.inTitleEditMode = !this.instance.inTitleEditMode;}
},
InstanceSaveTitle: function(WidgetDiv_Header_Lbl, WidgetDiv_Header_Input) {
if (myTabs.hasRequiredTabPermission(this.Tab, TabAccessLevel.Widget_EditTitle)) {
if (!WidgetDiv_Header_Lbl)
WidgetDiv_Header_Lbl = this.instance.WidgetDiv_Header_Lbl;if (!WidgetDiv_Header_Input)
WidgetDiv_Header_Input = this.instance.WidgetDiv_Header_Input;if (WidgetDiv_Header_Input.value != WidgetDiv_Header_Lbl.innerHTML) {
JSON.Widget_UpdateProperty(this.Tab.id, this.id, 'Title', WidgetDiv_Header_Input.value);WidgetDiv_Header_Lbl.innerHTML = WidgetDiv_Header_Input.value;}
this.instance.inTitleEditMode = true;this.instance.TitleEdit();}
else {
alert("You do not have permission to edit the widget title");}
}
}
WidgetInstance = function(WidgetObj)
{
/*
this.Widget = WidgetObj;this.id = this.Widget.id;this.inEditMode = false;this.inTitleEditMode = false;WidgetObj.instance = this;this.Load();*/
}
WidgetInstance.prototype =
{
initializeBase : function(WidgetObj)
{
this.Widget = WidgetObj;this.id = this.Widget.id;this.inEditMode = false;this.inTitleEditMode = false;WidgetObj.instance = this;this.Load();},
Edit : function()
{
this.Widget.InstanceEdit();},
Save : function()
{
this.Widget.Save();},
Load : function()
{
this.Widget.InstanceLoad();this.Widget.InstanceLoadComplete();},
ToggleExpand : function()
{
this.Widget.InstanceToggleExpand();},
Expand : function()
{
this.Widget.obj.Expanded = false;this.Widget.InstanceToggleExpand();},
Collapse : function()
{
this.Widget.obj.Expanded = true;this.Widget.InstanceToggleExpand();},
Delete : function()
{
this.Widget.Delete(this);},
TitleEdit : function()
{
this.Widget.InstanceTitleEdit();},
SaveTitle : function()
{
this.Widget.InstanceSaveTitle();},
SaveHeight : function(theHeight)
{
JSON.Widget_UpdateProperty(this.Widget.Tab.id, this.id, 'height', parseInt(theHeight));this.Widget.obj.Height = theHeight;},
ResetHeight : function()
{
JSON.Widget_UpdateProperty(this.Widget.Tab.id, this.id, 'height', parseInt(0));},
InstanceRefresh : function()
{
var theDiv = $get(this.WidgetDiv.id);theDiv.parentNode.removeChild(theDiv);grabContent(this.Widget.obj.URL, Function.createDelegate(this.Widget, this.Widget.RenderWidget));},
Refresh : function()
{
this.InstanceRefresh();}
}
_myWidgets = function()
{
this.WidgetInstances = new Array();}
_myWidgets.prototype =
{
toString: function() {
for (var i = 0; i < this.WidgetInstances.length; i++) {
var wi = this.WidgetInstances[i];WriteHistory(i + ": Tab #" + wi.Widget.Tab.id + ": Widget #" + wi.id + ": Col #" + wi.Widget.obj.ColumnNo + " : Order #" + wi.Widget.obj.OrderNo + " : Title : " + wi.Widget.obj.Title);}
},
AddWidgetInstance: function(obj) {
this.WidgetInstances.push(obj);},
GetWidgetInstance: function(id) {
for (var i = 0; i < this.WidgetInstances.length; i++) {
if (this.WidgetInstances[i].id == id) {
return this.WidgetInstances[i];}
}
return null;},
RemoveWidgetInstance: function(id) {
if (myTabs.hasRequiredTabPermission(null, TabAccessLevel.Widget_Delete)) {
for (var i = 0; i < this.WidgetInstances.length; i++) {
if (this.WidgetInstances[i].id == id) {
if (this.WidgetInstances[i].Widget.Tab.Widgets.length < 2) {
ShowNoWidget();}
this.WidgetInstances.splice(i, 1);return;}
}
}
return null;},
GenerateForTab: function(theTab) {
if (theTab.Widgets.length > 0) {
this.GenerateTabWidgets(theTab);}
else {
JSON.Tab_GetWidgets(theTab.id, Function.createDelegate(this, this.Tab_GetWidgets));}
},
Tab_GetWidgets: function(obj) {
var hasWidgets = false;if (obj) {
var theTab = myTabs.FindTab(obj.TabID);if (theTab) {
if (obj.Widgets) {
theTab.Widgets = new Array();for (var i = 0; i < obj.Widgets.length; i++) {
hasWidgets = true;theTab.Widgets.push(new _Widget(obj.Widgets[i], theTab));}
WriteHistory("Tab_GetWidgets:#Widgets:" + theTab.Widgets.length);this.GenerateTabWidgets(theTab);}
}
}
if (!hasWidgets) {
div_WidgetProgress.style.display = "none";ShowNoWidget()
}
},
AddWidget: function(WidgetId) {
if (myTabs.hasRequiredTabPermission(null, TabAccessLevel.Tab_AddWidgets)) {
var theTab = myTabs.GetCurrentTab();JSON.Tab_AddWidget(theTab.id, WidgetId, Function.createDelegate(this, this.Tab_AddWidgets));}
},
AddRSS: function(URL) {
if (myTabs.hasRequiredTabPermission(null, TabAccessLevel.Tab_AddWidgets)) {
var theTab = myTabs.GetCurrentTab();JSON.Tab_AddRSSWidget(theTab.id, URL, Function.createDelegate(this, this.Tab_AddWidgets));}
},
Tab_AddWidgets: function(obj) {
if (myTabs.hasRequiredTabPermission(null, TabAccessLevel.Tab_AddWidgets)) {
if (obj) {
var theTab = myTabs.GetCurrentTab();if (theTab) {
var theWidget = new _Widget(obj, theTab);var ary = theTab.Widgets;for (var i = 0; i < ary.length; i++) {
if ((ary[i].obj.ColumnNo == obj.ColumnNo && ary[i].obj.OrderNo >= obj.OrderNo)) {
ary[i].obj.OrderNo += 1;}
}
theTab.Widgets.push(theWidget);this.SortWidgetArray(theTab);WriteHistory("Tab_GetWidgets:#Widgets:" + theTab.Widgets.length);this.GenerateTabWidget(theWidget);}
}
}
},
GenerateTabWidget: function(theWidget) {
HideNoWidget();grabContent(theWidget.obj.URL, Function.createDelegate(theWidget, theWidget.RenderWidget));},
GenerateTabWidgets: function(theTab) {
removeChildNodes(theTab.Element_Cell1);removeChildNodes(theTab.Element_Cell2);removeChildNodes(theTab.Element_Cell3);if (theTab.Element_Cell4)
removeChildNodes(theTab.Element_Cell4);var theWidgets = theTab.Widgets;this.SortWidgetArray(theTab);for (var i = 0; i < theWidgets.length; i++) {
this.GenerateTabWidget(theWidgets[i]);}
},
SortWidgetArray: function(Tab) {
var ary = Tab.Widgets;for (var i = 0; i < ary.length; i++) {
for (var j = i + 1; j < ary.length; j++) {
if ((ary[i].obj.ColumnNo < ary[j].obj.ColumnNo) ||
(ary[i].obj.ColumnNo == ary[j].obj.ColumnNo && ary[i].obj.OrderNo < ary[j].obj.OrderNo)
) {
var t = ary[i];ary[i] = ary[j];ary[j] = t;}
}
}
/*
for(var i=0;i<ary.length;i++)
{
WriteHistory(ary[i].id + " : " + ary[i].obj.Title + " : " + ary[i].obj.ColumnNo + " : " + ary[i].obj.OrderNo);}
*/
}
}
var myWidgets = new _myWidgets();function $WI(id)
{
return myWidgets.GetWidgetInstance(id);}
_Tab = function(element)
{
this.id = element.id;this.obj = element;this.Element_Widgets = null;this.loaded = false;this.Widgets = new Array();if(element.Widgets)
{
for(var i=0;i<element.Widgets.length;i++)
{
this.Widgets.push(new _Widget(element.Widgets[i], this));}
}
}
_Tab.prototype =
{
FindWidget: function(widgetId) {
for (var i = 0; i < this.Widgets.length; i++) {
if (this.Widgets[i].id == widgetId)
return this.Widgets[i];}
return null;},
hasRequiredTabPermission: function(Permission) {
var Tab = this;for (var i = 0; i < Tab.obj.AccessLevel.length; i++) {
if (Tab.obj.AccessLevel[i] == Permission || Tab.obj.AccessLevel[i] == TabAccessLevel.Owner)
return true;}
return false;},
TellMePermission: function() {
var Tab = this;var Permission = "You have the following permission for this tab:\n";for (var i = 0; i < Tab.obj.AccessLevel.length; i++) {
Permission += "- " + GetAccessLevelStr(Tab.obj.AccessLevel[i]) + "\n";}
alert(Permission);},
Dispose: function() {
this.loaded = false;for (var i = 0; i < this.Widgets.length; i++)
if (this.Widgets[i].Dispose)
this.Widgets[i].Dispose();this.Widgets = new Array();var IDToRemove = "WTab_" + this.id;if (div_Widgets.childNodes) {
var ttl = div_Widgets.childNodes.length;for (var i = 0; i < ttl; i++) {
var e = div_Widgets.childNodes[i];var eID = "";if (e && e.id)
eID = e.id;if (eID.length >= IDToRemove.length) {
if (eID.substring(0, IDToRemove.length) == IDToRemove) {
div_Widgets.removeChild(e);ttl--;i--;}
}
}
}
},
Render: function() {
this.Dispose();if (this.obj.InnerHTML.length > 0) {
div_WidgetProgress.style.display = "none";var TabInnerHTML = this.obj.InnerHTML;TabInnerHTML = TabInnerHTML.replace("WTab", "WTab_" + this.id);TabInnerHTML = TabInnerHTML.replace("td_1", "c" + this.id + "_1");TabInnerHTML = TabInnerHTML.replace("td_2", "c" + this.id + "_2");TabInnerHTML = TabInnerHTML.replace("td_3", "c" + this.id + "_3");TabInnerHTML = TabInnerHTML.replace("td_4", "c" + this.id + "_4");div_Widgets.innerHTML += TabInnerHTML;eWidget = document.getElementById("WTab_" + this.id);this.Element_Cell1 = document.getElementById("c" + this.id + "_1");this.Element_Cell2 = document.getElementById("c" + this.id + "_2");this.Element_Cell3 = document.getElementById("c" + this.id + "_3");this.Element_Cell4 = document.getElementById("c" + this.id + "_4");return eWidget;}
else {
eWidget = document.createElement("div");eWidget.id = "WTab_" + this.id;setElementToAjaxLoading(eWidget, "<div align='center'>", "</div>");eWidget.appendChild(document.createTextNode(this.id + " : " + this.obj.Title));div_Widgets.appendChild(eWidget);var eTbl = document.createElement("table");eTbl.setAttribute("width", "100%");eTbl.setAttribute("cellpadding", "0");eTbl.setAttribute("cellspacing", "0");eTbl.setAttribute("height", "250px");eTbl.setAttribute("border", "0");var eTBody = document.createElement("tbody");var eRow = document.createElement("tr");eRow.setAttribute("valign", "top");var eCell1 = document.createElement("td");eCell1.id = "c" + this.id + "_1";eCell1.setAttribute("width", this.obj.PanelWidth_1 + "%");eCell1.style.position = "relative";var eCell2 = document.createElement("td");eCell2.id = "c" + this.id + "_2";if (this.obj.PanelWidth_2 > 0) {
eCell2.setAttribute("width", this.obj.PanelWidth_2 + "%");}
else {
eCell2.setAttribute("width", "0");eCell2.style.display = "none";}
eCell2.style.position = "relative";var eCell3 = document.createElement("td");eCell3.id = "c" + this.id + "_3";if (this.obj.PanelWidth_3 > 0) {
eCell3.setAttribute("width", this.obj.PanelWidth_3 + "%");}
else {
eCell3.setAttribute("width", "0");eCell3.style.display = "none";}
eCell3.style.position = "relative";eRow.appendChild(eCell1);eRow.appendChild(eCell2);eRow.appendChild(eCell3);eTBody.appendChild(eRow);eTbl.appendChild(eTBody);removeChildNodes(eWidget);eWidget.appendChild(eTbl);this.Element_Cell1 = eCell1;this.Element_Cell2 = eCell2;this.Element_Cell3 = eCell3;return eWidget;}
return null;}
}
_myTabs = function()
{
this.Tabs = new Array();this.ActiveTabID = -1;}
_myTabs.prototype =
{
onTabChange: function() {
tab_width = 0;for (var i = 0; i < div_TabList.childNodes.length; i++) {
var e = div_TabList.childNodes[i];if (e) {
WriteHistory(e.id + ":" + e.clientWidth + ":" + e.offsetWidth);tab_width += getElementWidth(e) + 5;}
}
var holderWidth = f_clientWidth() - 200;if (holderWidth < tab_width) {
$show("tab_L");$show("tab_R");div_tabHolder.style.width = holderWidth + "px";div_TabList.style.width = tab_width + "px";var CurrentTab = this.GetCurrentTab();if (CurrentTab && CurrentTab.Element_Main) {
var E_M = CurrentTab.Element_Main;var NewMarginLeft = parseInt(E_M.offsetLeft + getElementWidth(E_M)) - parseInt(div_tabHolder.style.width);WriteHistory(NewMarginLeft + ":" + CurrentTab.Element_Main.offsetLeft + ":" + div_tabHolder.style.width);if (NewMarginLeft > 0) {
div_TabList.style.marginLeft = (-NewMarginLeft) + "px";}
}
}
else {
$hide("tab_L");$hide("tab_R");if (is_ie) {
div_tabHolder.style.width = tab_width + "px";}
else {
div_tabHolder.style.width = "";}
div_TabList.style.marginLeft = "0px";}
WriteHistory("Total Width:" + tab_width + ":" + holderWidth);},
TellMePermission: function(TabId) {
var Tab = this.FindTab(TabId);if (Tab)
Tab.TellMePermission();},
hasRequiredTabPermission: function(Tab, Permission) {
if (Tab == null) {
Tab = this.GetCurrentTab();}
return Tab.hasRequiredTabPermission(Permission);},
SaveTitle: function() {
var CurrentTab = this.GetCurrentTab();if (this.hasRequiredTabPermission(CurrentTab, TabAccessLevel.Tab_EditName)) {
WriteHistory("SaveTitle");if (CurrentTab) {
if (CurrentTab.Element_Input.value != CurrentTab.obj.Title) {
CurrentTab.obj.Title = CurrentTab.Element_Input.value;CurrentTab.Element_Txt.innerHTML = CurrentTab.obj.Title;JSON.Tab_SaveTitle(CurrentTab.obj.Title, this.ActiveTabID);}
CurrentTab.Element_Input.style.display = "none";CurrentTab.Element_Txt.style.display = "";CurrentTab.Element_Arrow.style.display = "";this.onTabChange();}
}
else {
alert("You do not have permission to edit the tab title");}
},
ResetTab: function(TabId) {
this.RefreshTab(TabId);},
RefreshTab: function(TabId) {
var Tab = this.FindTab(TabId);$hide("menu_" + Tab.id);Tab.Dispose();JSON.Tab_Refresh(TabId, Function.createDelegate(this, this.RefreshComplete));},
RefreshComplete: function(obj) {
var theTab = this.FindTab(obj.id);theTab.obj = obj;this.SwitchActiveTab(theTab.id);},
ReloadCurrentTab: function(intVal) {
if (intVal < 1) {
}
else {
var Tab = this.FindTab(intVal);Tab.Dispose();if (this.ActiveTabID == intVal) {
alert("This page has been changed, click ok to refresh the page");this.SwitchActiveTab(intVal);}
}
},
GenerateTab: function(Tab) {
WriteHistory("GenerateTab" + Tab.id);var eTab = document.createElement("li");eTab.setAttribute("id", "p_" + Tab.id);var eTxt = document.createElement("span");eTxt.setAttribute("id", "t_" + Tab.id);eTxt.innerHTML = Tab.obj.Title;var f1 = "myTabs.SwitchActiveTab(" + Tab.id + ")";eTxt.onclick = function() { eval(f1); };eTab.appendChild(eTxt);var eDiv = document.createElement("div");eDiv.id = "menu_" + Tab.id;var eDIV_M1 = "";if (Tab.hasRequiredTabPermission(TabAccessLevel.Tab_Share)) {
eDIV_M1 += "<li><a onclick='myTabs.ShareTab(" + Tab.id + ");'>Share Tab</a></li>";}
eDIV_M1 += "<li><a onclick='myTabs.DeleteTab(" + Tab.id + ");'>Delete Tab</a></li>";eDIV_M1 += "<li><a onclick='myTabs.TellMePermission(" + Tab.id + ");'>Tab Permissions</a></li>";eDIV_M1 += "<li><a onclick='myTabs.RefreshTab(" + Tab.id + ");'>Refresh Tab</a></li>";eDiv.innerHTML = "<ul class='DDMenu'>" + eDIV_M1 + "</ul>";eDiv.className = "DropDownMenu";div_Widgets.appendChild(eDiv);var eArrow = document.createElement("a");eArrow.setAttribute("id", "a_" + Tab.id);eArrow.className = "tab_arrow";eArrow.width = 10;eArrow.height = 10;eArrow.onclick = expand;if (is_ie) {
eArrow.href = "javascript:void(0);";eArrow.innerHTML = "<img src='/images/pixel.gif' border='0' width='1px' height='10px' />";}
eArrow.onmouseout = function() { collapse(this.id); };eArrow.setAttribute("border", 0);eTab.appendChild(eArrow);if (this.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_EditName)) {
var eInp = document.createElement("input");eInp.setAttribute("id", "i_" + Tab.id);eInp.onblur = function() { myTabs.SaveTitle(); };if (is_ie)
eInp.onkeypress = function() { if (event.keyCode == 13) { myTabs.SaveTitle(); event.keyCode = 0; return false; } };else
eInp.onkeypress = function(event) { if (event.keyCode == 13) { myTabs.SaveTitle(); return false; } };eInp.value = Tab.obj.Title;eInp.style.display = "none";eTab.appendChild(eInp);}
eTab.className = "tab inactivetab";div_TabList.appendChild(eTab);installScript("Menu_AddTarget('a_" + Tab.id + "', '" + eDiv.id + "');");Tab.Element_Txt = eTxt;if (this.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_EditName)) {
Tab.Element_Input = eInp;}
else {
Tab.Element_Input = null;}
Tab.Element_Main = eTab;Tab.Element_Arrow = eArrow;},
GetCurrentTab: function() {
return this.FindTab(this.ActiveTabID);},
SwitchActiveTab: function(TabId) {
WriteHistory("SwitchActiveTab" + TabId);var CurrentTab = this.GetCurrentTab();var NewTab = this.FindTab(TabId);if (NewTab != null) {
if (CurrentTab != null) {
var f1 = "myTabs.SwitchActiveTab(" + CurrentTab.id + ")";CurrentTab.Element_Txt.onclick = function() { eval(f1); };if (CurrentTab.Element_Input) {
CurrentTab.Element_Input.style.display = "none";}
CurrentTab.Element_Txt.style.display = "";CurrentTab.Element_Arrow.style.display = "";CurrentTab.Element_Main.className = "tab inactivetab";if (CurrentTab.Element_Widgets) {
CurrentTab.Element_Widgets.style.display = "none";}
JSON.User_UpdateActiveTab(NewTab.id);}
if (this.hasRequiredTabPermission(NewTab, TabAccessLevel.Tab_ChangeLayout)) {
$show('banner_modifyLayout', 'NONE');}
else {
$hide('banner_modifyLayout');}
if (this.hasRequiredTabPermission(NewTab, TabAccessLevel.Tab_AddWidgets)) {
$show('banner_addWidget', 'NONE');$show('banner_sep1', 'NONE');}
else {
$hide('banner_addWidget');$hide('banner_sep1');}
if (this.hasRequiredTabPermission(NewTab, TabAccessLevel.Tab_EditName)) {
var f2 = "$show('" + NewTab.Element_Input.id + "','inline',true);$hide('" + NewTab.Element_Txt.id + "');$hide('" + NewTab.Element_Arrow.id + "');";NewTab.Element_Txt.onclick = function() { eval(f2); };NewTab.Element_Main.className = "tab activetab";}
else {
NewTab.Element_Txt.onclick = null;NewTab.Element_Main.className = "tab activetab";}
this.ActiveTabID = TabId;WriteHistory("Switching WidgetInfo");var eMenu = $get("MenuWidgetAddWidgetBtn");if (eMenu) {
var TabTitle = NewTab.obj.Title;if (TabTitle) {
if (TabTitle.length > 10) {
TabTitle = TabTitle.substring(0, 8) + "..";}
TabTitle = "\"" + TabTitle + "\" Tab";}
else {
TabTitle = "Tab";}
eMenu.value = "Add To " + TabTitle;}
if (NewTab.loaded && NewTab.Element_Widgets) {
WriteHistory("Historical Page");NewTab.Element_Widgets.style.display = "block";HideNoWidget();}
else {
WriteHistory("New Page");div_WidgetProgress.style.display = "";HideNoWidget();var eWidget = NewTab.Render();myWidgets.GenerateForTab(NewTab);setTimeout("myTabs.LoadWidgetScripts()", 500);NewTab.Element_Widgets = eWidget;NewTab.Element_Widgets.style.display = "block";NewTab.loaded = true;if (this.hasRequiredTabPermission(NewTab, TabAccessLevel.Widget_Reorder)) {
this.EnableWidgetDragDrop(NewTab, 1);this.EnableWidgetDragDrop(NewTab, 2);this.EnableWidgetDragDrop(NewTab, 3);if (NewTab.Element_Cell4) {
this.EnableWidgetDragDrop(NewTab, 4);}
}
}
}
else {
alert("Unable to switch tabs\n" + TabId);}
this.onTabChange();},
LoadWidgetScripts: function() {
WriteHistory("LoadWidgetScripts");var Tab = this.GetCurrentTab();for (var i = 0; i < Tab.Widgets.length; i++) {
var theWidget = Tab.Widgets[i];if (!Tab.Widgets[i].loaded) {
WriteHistory("Widget #" + Tab.Widgets[i].id + " not loaded");if (this.DoLoad_Idx)
this.DoLoad_Idx++;else
this.DoLoad_Idx = 1;if (this.DoLoad_Idx < 10)
setTimeout("myTabs.LoadWidgetScripts()", 1000);return;}
}
JSScripts.RunAllScripts();},
AddNewTab: function() {
JSON.Tab_Add(Function.createDelegate(this, this.onAddNewTabSuccess));},
onAddNewTabSuccess: function(obj) {
if (obj) {
var Tab = new _Tab(obj);this.Tabs.push(Tab);this.GenerateTab(Tab);this.EnableDragDrop();this.onTabChange();}
},
ShareTab: function(TabId) {
var Tab = myTabs.FindTab(TabId);if (this.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_Share)) {
winopen("/tab_modifyshare.aspx?id=" + TabId, 450, 400);}
else {
alert("You do not have permission to perform this action");}
},
DeleteTab: function(TabId) {
var Tab = myTabs.FindTab(TabId);if (this.Tabs.length < 2) {
alert("There needs to be at least one Tab on your workspace");}
else {
$hide("menu_" + Tab.id);if (confirm("Are you sure you want to delete the " + Tab.obj.Title.replace("\"", "\\\"") + " Tab?")) {
var proceed = false;if (confirm("Once you delete this tab, there is no way to recover the contents of this tab. \nAre you really sure you want to delete the " + Tab.obj.Title.replace("\"", "\\\"") + " Tab?")) {
if (Tab.hasRequiredTabPermission(TabAccessLevel.Tab_Delete)) {
proceed = true;}
else {
proceed = true;}
}
if (proceed) {
var elementid = -1;for (var i = 0; i < this.Tabs.length; i++) {
if (this.Tabs[i].id == TabId) {
elementid = i;break;}
}
if (elementid > -1) {
var Tab = this.Tabs[elementid];div_TabList.removeChild(Tab.Element_Main);if (Tab.Element_Widgets)
div_Widgets.removeChild(Tab.Element_Widgets);JSON.Tab_Delete(Tab.id, this.ActiveTabID);if (Tab.id == this.ActiveTabID) {
if (elementid == 0) {
this.SwitchActiveTab(this.Tabs[elementid + 1].id);}
else {
this.SwitchActiveTab(this.Tabs[elementid - 1].id);}
}
this.Tabs.splice(elementid, 1);}
}
}
}
this.onTabChange();},
FindTab: function(Tabid) {
for (var i = 0; i < this.Tabs.length; i++) {
if (this.Tabs[i].id == Tabid)
return this.Tabs[i];}
return null;},
FirstLoad: function() {
JSON.UserFirstLoad(Function.createDelegate(this, this.onContentLoad));},
onContentLoad: function(obj) {
if (obj) {
WriteHistory("OnContentLoad" + div_TabList);if (div_TabList.childNodes.length > 0)
removeChildNodes(div_TabList);this.ActiveTabID = obj.ActiveTabID;var eTabs = obj.Tabs;this.Tabs = new Array();for (var i = 0; i < eTabs.length; i++) {
var Tab = new _Tab(eTabs[i]);this.Tabs.push(Tab);this.GenerateTab(Tab);}
this.SwitchActiveTab(this.ActiveTabID);this.EnableDragDrop();}
else {
alert("We are unable to get the list of Tabs for your account");}
},
ChangeHtmlLayout: function(textareaid) {
var CustomHTML = document.getElementById(textareaid);},
ChangeLayout_Complete: function() {
var Tab = this.GetCurrentTab();this.RefreshTab(Tab.id);},
ChangeLayout: function(c1, c2, c3, c4, innerHTML) {
var Tab = this.GetCurrentTab();if (innerHTML == null)
innerHTML = document.getElementById("layout_innerhtml").value;if (this.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_ChangeLayout)) {
if (innerHTML.length > 0) {
Tab.obj.InnerHTML = innerHTML;JSON.Tab_Resize(Tab.id, 0, 0, 0, 0, innerHTML, Function.createDelegate(this, this.ChangeLayout_Complete));}
else {
Tab.Element_Cell1.setAttribute("width", c1 + "%");if (c2 > 0) {
Tab.Element_Cell2.style.display = "";Tab.Element_Cell2.setAttribute("width", c2 + "%");}
else {
Tab.Element_Cell2.style.display = "none";Tab.Element_Cell2.setAttribute("width", "0");}
if (c3 > 0) {
Tab.Element_Cell3.style.display = "";Tab.Element_Cell3.setAttribute("width", c3 + "%");}
else {
Tab.Element_Cell3.style.display = "none";Tab.Element_Cell3.setAttribute("width", "0");}
if (c4 > 0 && Tab.Element_Cell4) {
Tab.Element_Cell4.style.display = "";Tab.Element_Cell4.setAttribute("width", c4 + "%");}
else {
Tab.Element_Cell4.style.display = "none";Tab.Element_Cell4.setAttribute("width", "0");}
Tab.obj.PanelWidth_1 = c1;Tab.obj.PanelWidth_2 = c2;Tab.obj.PanelWidth_3 = c3;Tab.obj.PanelWidth_4 = c4;JSON.Tab_Resize(Tab.id, c1, c2, c3, c4, "");if (c2 == 0 || c3 == 0 || c4 == 0) {
var c2To = -1;var c3To = -1;var c4To = -1;if (c4 == 0) {
c4To = 3;if (c3 == 0) {
c4To = 2;if (c2 == 0)
c4To = 1;}
}
if (c3 == 0) {
c3To = 2;if (c2 == 0)
c3To = 1;}
if (c2 == 0) {
c2To = 1;}
myWidgets.SortWidgetArray(Tab);var theWidgets = Tab.Widgets;var c1LastOrder = 0;var c2LastOrder = 0;var c3LastOrder = 0;for (var i = 0; i < theWidgets.length; i++) {
if (theWidgets[i].obj.ColumnNo == 1) {
if (c1LastOrder < theWidgets[i].obj.OrderNo)
c1LastOrder = theWidgets[i].obj.OrderNo;}
else if (theWidgets[i].obj.ColumnNo == 2) {
if (c2LastOrder < theWidgets[i].obj.OrderNo)
c2LastOrder = theWidgets[i].obj.OrderNo;}
else if (theWidgets[i].obj.ColumnNo == 3) {
if (c3LastOrder < theWidgets[i].obj.OrderNo)
c3LastOrder = theWidgets[i].obj.OrderNo;}
}
/*
_Tab.Element_Cell1 -> Widget Column1
_Tab.Element_Cell2 -> Widget Column2
_Tab.Element_Cell3 -> Widget Column3
*/
var Movement = "";for (var i = 0; i < theWidgets.length; i++) {
var theWidget = theWidgets[i];if (c2To > 0 && theWidget.obj.ColumnNo == 2) {
theWidget.obj.OrderNo = ++c1LastOrder;this.MoveWidgetToColumn(Tab, theWidget, c2To);}
else if (c3To > 0 && theWidget.obj.ColumnNo == 3) {
switch (c3To) {
case 2:
theWidget.obj.OrderNo = ++c2LastOrder;break;case 1:
theWidget.obj.OrderNo = ++c1LastOrder;break;}
this.MoveWidgetToColumn(Tab, theWidget, c3To);}
else if (c4To > 0 && theWidget.obj.ColumnNo == 4) {
switch (c4To) {
case 3:
theWidget.obj.OrderNo = ++c3LastOrder;break;case 2:
theWidget.obj.OrderNo = ++c2LastOrder;break;case 1:
theWidget.obj.OrderNo = ++c1LastOrder;break;}
this.MoveWidgetToColumn(Tab, theWidget, c4To);}
}
var C1ID = "";var C2ID = "";var C3ID = "";var C4ID = "";var Nodes = Tab.Element_Cell1.childNodes
for (var i = 0; i < Nodes.length; i++) {
var theDivId = Nodes[i].id;if (theDivId.length > 5) {
var WidgetInstanceID = parseInt(theDivId.substring(5));if (WidgetInstanceID > 0)
C1ID += WidgetInstanceID + ",";}
}
Nodes = Tab.Element_Cell2.childNodes;for (var i = 0; i < Nodes.length; i++) {
var theDivId = Nodes[i].id;if (theDivId.length > 5) {
var WidgetInstanceID = parseInt(theDivId.substring(5));if (WidgetInstanceID > 0)
C2ID += WidgetInstanceID + ",";}
}
Nodes = Tab.Element_Cell3.childNodes;for (var i = 0; i < Nodes.length; i++) {
var theDivId = Nodes[i].id;if (theDivId.length > 5) {
var WidgetInstanceID = parseInt(theDivId.substring(5));if (WidgetInstanceID > 0)
C3ID += WidgetInstanceID + ",";}
}
if (Tab.Element_Cell4) {
Nodes = Tab.Element_Cell4.childNodes;for (var i = 0; i < Nodes.length; i++) {
var theDivId = Nodes[i].id;if (theDivId.length > 5) {
var WidgetInstanceID = parseInt(theDivId.substring(5));if (WidgetInstanceID > 0)
C4ID += WidgetInstanceID + ",";}
}
}
JSON.Tab_UpdateWidgetOrder(Tab.id, 1, C1ID);JSON.Tab_UpdateWidgetOrder(Tab.id, 2, C2ID);JSON.Tab_UpdateWidgetOrder(Tab.id, 3, C3ID);JSON.Tab_UpdateWidgetOrder(Tab.id, 4, C4ID);myWidgets.SortWidgetArray(Tab);}
}
}
else {
alert("You do not have permission to change layout of the page");}
},
MoveWidgetToColumn: function(Tab, Widget, Column) {
if (this.hasRequiredTabPermission(Tab, TabAccessLevel.Widget_Reorder)) {
WriteHistory("MoveWidgetToColumn: " + Tab.id + " : " + Widget.id + " : " + Column + " : " + Widget.obj.ColumnNo);var RenderInColumn = null;var RemoveFromColumn = null;switch (Column) {
case 2:
RenderInColumn = Tab.Element_Cell2;break;case 3:
RenderInColumn = Tab.Element_Cell3;break;case 4:
RenderInColumn = Tab.Element_Cell4;break;case 1:
RenderInColumn = Tab.Element_Cell1;break;}
switch (Widget.obj.ColumnNo) {
case 2:
RemoveFromColumn = Tab.Element_Cell2;break;case 3:
RemoveFromColumn = Tab.Element_Cell3;break;case 4:
RemoveFromColumn = Tab.Element_Cell4;break;case 1:
RemoveFromColumn = Tab.Element_Cell1;break;}
if (!RenderInColumn) {
WriteHistory("RenderInColumn is null: " + Column);}
if (!RemoveFromColumn) {
WriteHistory("RemoveFromColumn is null: " + Widget.obj.ColumnNo);}
WriteHistory("RemoveFromColumn: " + RemoveFromColumn.id + ":" + Widget.instance.WidgetDiv.id + ":" + Widget.obj.Title + " : MoveTo: " + RenderInColumn.id);RemoveFromColumn.removeChild(Widget.instance.WidgetDiv);Widget.obj.ColumnNo = Column;if (RenderInColumn.childNodes.length <= Widget.obj.OrderNo) {
RenderInColumn.appendChild(Widget.instance.WidgetDiv);}
else {
RenderInColumn.insertBefore(Widget.instance.WidgetDiv, RenderInColumn.childNodes[Widget.obj.OrderNo - 1]);}
}
else {
alert("You do not have permission to reorder widgets");}
},
EnableDragDrop: function() {
Sortable.destroy(div_TabList.id);Sortable.create(div_TabList.id,
{
overlap: 'horizontal',
dropOnEmpty: false,
containment: [div_TabList.id],
constraint: 'horizontal',
onUpdate: function(sortable) {
if (sortable.id) {
var Elements = sortable.getElementsByTagName("li");var TabIds = "";for (var i = 0; i < Elements.length; i++) {
var TabId = parseInt(Elements[i].id.substring(2));TabIds += TabId + ",";}
WriteHistory("TabOnUpdate: " + TabIds);JSON.Tab_UpdatePosition(TabIds);}
} /*,
onChange:function(element){
}*/
});},
EnableWidgetDragDrop: function(Tab, Col) {
if (this.hasRequiredTabPermission(Tab, TabAccessLevel.Widget_Reorder)) {
var strCol = "";switch (Col) {
case 2:
strCol = Tab.Element_Cell2.id;break;case 3:
strCol = Tab.Element_Cell3.id;break;case 4:
if (Tab.Element_Cell4)
strCol = Tab.Element_Cell4.id;else
strCol = Tab.Element_Cell1.id;break;default:
strCol = Tab.Element_Cell1.id;break;}
var Containment = [Tab.Element_Cell1.id, Tab.Element_Cell2.id, Tab.Element_Cell3.id];if (Tab.Element_Cell4)
Containment = [Tab.Element_Cell1.id, Tab.Element_Cell2.id, Tab.Element_Cell3.id, , Tab.Element_Cell4.id];WriteHistory("EnableWidgetDragDrop: " + Tab.id + ":" + Col);Sortable.destroy(strCol);Sortable.create(strCol,
{
tag: 'div',
only: 'widget',
constraint: false,
containment: Containment,
handle: 'widget_header',
hoverclass: 'widget_hover',
dropOnEmpty: true,
onUpdate: function(sortable) {
WriteHistory("onUpdate<br>" + sortable.id);if (sortable.id) {
var Widgets = "";var Tab = myTabs.GetCurrentTab();var Col = parseInt(sortable.id.substring(2 + Tab.id.toString().length));var Elements = new Array();for (var i = 0; i < sortable.childNodes.length; i++) {
var Node = sortable.childNodes[i];if (Node.className == "widget")
Elements.push(Node);}
for (var i = 0; i < Elements.length; i++) {
var WidgetId = parseInt(Elements[i].id.substring(5));var theWidget = Tab.FindWidget(WidgetId);theWidget.obj.ColumnNo = Col;theWidget.obj.OrderNo = i + 1;Widgets += WidgetId + ",";}
WriteHistory("WidgetsOnUpdate: " + Widgets + ":" + Col);JSON.Tab_UpdateWidgetOrder(Tab.id, Col, Widgets);}
}
});}
else {
alert("You do not have permission to reorder widgets");}
}
};var myTabs = new _myTabs();var tab_tout=null;var tab_width=0;var tab_speed = 5;var tab_spacer = 200;function right(){
if(!div_TabList.style.marginLeft){ marg = 0; } else {
marg = parseInt(div_TabList.style.marginLeft); }
marg -= tab_speed;if(parseInt(tab_width+marg)>parseInt(div_tabHolder.clientWidth)){
div_TabList.style.marginLeft = marg + "px";div_TabList.style.width = (tab_spacer+parseInt(div_tabHolder.style.width)-marg)+ "px";}
tab_tout = setTimeout("right()",0);}
function left(){
if(!div_TabList.style.marginLeft){ marg = 0; } else {
marg = parseInt(div_TabList.style.marginLeft); }
if(marg < 0){
marg += tab_speed;WriteHistory("L: " + div_TabList.style.marginLeft);div_TabList.style.marginLeft = marg + "px";div_TabList.style.width = (tab_spacer+parseInt(div_tabHolder.style.width)-marg)+ "px";tab_tout = setTimeout("left()",0);}
}
function pause(){
clearTimeout(tab_tout)
}
_menu = function()
{
this.Element = $get("Menu");this.Widget = {};this.Widget.Content = null;this.Widget.Loaded = false;this.RSS = {};this.RSS.Content = null;this.RSS.Loaded = false;this.Layout = {};this.Layout.Content = null;this.Layout.Loaded = false;this.Theme = {};this.Theme.Content = null;this.Theme.Loaded = false;this.Profile = {};this.Profile.Content = null;this.Profile.Loaded = false;this.LastItem = 1;this.Loaded = false;this.IsVisible = false;}
_menu.prototype =
{
Reset: function() {
this.Element = $get("Menu");this.Widget = {};this.Widget.Content = null;this.Widget.Loaded = false;this.RSS = {};this.RSS.Content = null;this.RSS.Loaded = false;this.Layout = {};this.Layout.Content = null;this.Layout.Loaded = false;this.Theme = {};this.Theme.Content = null;this.Theme.Loaded = false;this.Profile = {};this.Profile.Content = null;this.Profile.Loaded = false;this.LastItem = 1;this.Loaded = false;this.IsVisible = false;},
Toggle: function() {
if (this.IsVisible) {
this.Hide();}
else {
this.Show();}
},
Show: function(Item) {
if (Item) {
this.LastItem = Item;}
this.Element.style.display = "";if (this.Loaded) {
this.Show2();}
else {
setElementToAjaxLoading(this.Element);grabContent("/Menu/Menu.aspx", Function.createDelegate(this, this.ShowMenu));}
},
ShowMenu: function(content) {
this.Element.innerHTML = content;this.Widget.Content = $get("MenuContentWidget");this.Profile.Content = $get("MenuContentProfile");this.Layout.Content = $get("MenuContentLayout");this.Theme.Content = $get("MenuContentTheme");this.RSS.Content = $get("MenuContentRSS");this.MenuNoPermission = $get("MenuNoPermission");this.Loaded = true;this.Show2();},
Show2: function() {
this.IsVisible = true;switch (this.LastItem) {
case 2:
this.ShowLayout();break;case 3:
this.ShowTheme();break;case 4:
this.ShowRSS();break;case 5:
this.ShowProfile();break;default:
this.ShowWidgets();break;}
},
Hide: function() {
this.IsVisible = false;if (this.Element) {
this.Element.style.display = "none";}
},
ShowContent: function(Item) {
this.Widget.Content.style.display = "none";this.Layout.Content.style.display = "none";this.Theme.Content.style.display = "none";this.RSS.Content.style.display = "none";this.Profile.Content.style.display = "none";this.MenuNoPermission.style.display = "none";var Tab = myTabs.GetCurrentTab();switch (Item) {
case 2:
MenuItem_Click($('mLayout'), 'MenuItem');$('mLayout').className = 'MenuItem MenuItemOver';if (myTabs.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_ChangeLayout)) {
this.Layout.Content.style.display = "";}
else {
this.MenuNoPermission.style.display = "";}
break;case 3:
MenuItem_Click($('mTheme'), 'MenuItem');$('mTheme').className = 'MenuItem MenuItemOver';if (myTabs.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_ChangeTheme)) {
this.Theme.Content.style.display = "";}
else {
this.MenuNoPermission.style.display = "";}
break;case 4:
MenuItem_Click($('mRSS'), 'MenuItem');$('mRSS').className = 'MenuItem MenuItemOver';if (myTabs.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_AddWidgets)) {
this.RSS.Content.style.display = "";}
else {
this.MenuNoPermission.style.display = "";}
break;case 5:
MenuItem_Click($('mProfile'), 'MenuItem');$('mProfile').className = 'MenuItem MenuItemOver';this.Profile.Content.style.display = "";break;default:
MenuItem_Click($('mWidget'), 'MenuItem');$('mWidget').className = 'MenuItem MenuItemOver';if (myTabs.hasRequiredTabPermission(Tab, TabAccessLevel.Tab_AddWidgets)) {
this.Widget.Content.style.display = "";}
else {
this.MenuNoPermission.style.display = "";}
break;}
},
ShowWidgets: function() {
WriteHistory("ShowWidgets");this.ShowContent(1);if (!this.Widget.Loaded) {
this.Element.style.display = "";grabContent("/Menu/Widgets.aspx", Function.createDelegate(this, this.DisplayWidgets));}
},
DisplayWidgets: function(content) {
this.Widget.Content.innerHTML = content;removeChildNodes($get("MenuWidgetC1"));setElementToAjaxLoading($get("MenuWidgetC1"));removeChildNodes($get("MenuWidgets"));removeChildNodes($get("MenuWidgetInfo"));JSON.Menu_GetCategory(0, Function.createDelegate(this, this.DisplayWidgetsCategory));},
DisplayWidgetsCategory: function(obj) {
var Element = $get("MenuWidgetC1");removeChildNodes(Element);for (var i = 0; i < obj.length; i++) {
var e = document.createElement("div");e.id = "MenuWidgetC1_" + obj[i].ID;e.appendChild(document.createTextNode(obj[i].Category));e.className = "MenuCategoryItem";e.onmouseover = function() { this.className = 'MenuCategoryItem MenuCategoryItemOver'; };e.onmouseout = function() { MenuItem_OnMouseOut(this, 'MenuCategoryItem'); };Element.appendChild(e);if (i == 0) {
e.className += " MenuCategoryItemOver";Menu.DisplayWidgetsInCategory(obj[i].ID);}
installScript("$get('" + e.id + "').onclick = function(){MenuItem_Click(this, 'MenuCategoryItem');Menu.DisplayWidgetsInCategory(" + obj[i].ID + ")};");}
},
DisplayWidgetsInCategory: function(id) {
var Element = $get("MenuWidgets");removeChildNodes(Element);setElementToAjaxLoading(Element);JSON.Menu_GetCategoryWidgets(id, Function.createDelegate(this, this.DisplayWidgetsInCategory2));},
DisplayWidgetsInCategory2: function(obj) {
var Element = $get("MenuWidgets");removeChildNodes(Element);for (var i = 0; i < obj.length; i++) {
var e = document.createElement("div");e.id = "MenuWidgets_" + obj[i].ID;e.onmouseover = function() { this.className = 'WidgetItem WidgetItemOver'; };e.onmouseout = function() { var cls = this.getAttribute("classx"); if (cls == null) cls = ""; this.className = (cls.length > 0 ? cls : "WidgetItem"); };var txt = "<table border='0'><tr valign='top'><td>";if (obj[i].Image) {
txt += "<img src='" + obj[i].Image + "' border='0' /></td><td>";}
txt += obj[i].Title + "</td></tr></table>";e.innerHTML = txt;Element.appendChild(e);if (i == 0) {
e.className += " WidgetItemOver";this.DisplayWidgetInfo(obj[i].ID);}
installScript("$get('" + e.id + "').onclick = function(){MenuItem_Click(this, 'WidgetItem');Menu.DisplayWidgetInfo(" + obj[i].ID + ");}");}
},
DisplayWidgetInfo: function(id) {
var Element = $get("MenuWidgetInfo");removeChildNodes(Element);setElementToAjaxLoading(Element);JSON.Menu_GetWidgetInfo(id, Function.createDelegate(this, this.DisplayWidgetInfo2));},
DisplayWidgetInfo2: function(obj) {
var Element = $get("MenuWidgetInfo");removeChildNodes(Element);if (obj) {
var txt = "<table border='0'><tr valign='top'><td>";if (obj.Image) {
txt += "<img src='" + obj.Image + "' border='0' /></td><td>";}
txt += obj.Title + "</td></tr></table>";txt += "<div>" + obj.Description + "</div>";var TabTitle = myTabs.GetCurrentTab().obj.Title;if (TabTitle) {
if (TabTitle.length > 10) {
TabTitle = TabTitle.substring(0, 8) + "..";}
TabTitle = "&quot;" + TabTitle + "&quot; Tab";}
else {
TabTitle = "Tab";}
txt += "<input type='button' id='MenuWidgetAddWidgetBtn' value='Add To " + TabTitle + "' class='AddWidget' onclick='myWidgets.AddWidget(" + obj.ID + ")' />";/*
obj.ID
obj.URL
obj.DefaultState
*/
Element.innerHTML = txt;}
this.Widget.Loaded = true;},
ShowRSS: function() {
WriteHistory("ShowRSS");this.ShowContent(4)
if (!this.RSS.Loaded) {
grabContent("/Menu/RSS.aspx", Function.createDelegate(this, this.DisplayRSS));}
},
DisplayRSS: function(content) {
this.RSS.Content.innerHTML = content;setDefaultButton("RSS_XmlFile", "btn_RSS");$get('RSS_XmlFile').focus();this.RSS.Loaded = true;},
ShowProfile: function() {
WriteHistory("ShowProfile");this.ShowContent(5)
if (!this.Profile.Loaded) {
grabContent("/Menu/Profile.aspx", Function.createDelegate(this, this.DisplayProfile));}
},
DisplayProfile: function(content) {
this.Profile.Content.innerHTML = content;setDefaultButton("mp_Name", "btn_Profile");this.Profile.Loaded = true;$get("mp_Name").focus();},
UpdateProfile: function() {
WriteHistory("Update Profile");var FullName = $get("mp_Name").value;if (FullName.length < 1) {
alert("Please enter a UserName");$get("mp_Name").focus();}
else {
$show('mp_progress');JSON.User_UpdateProfile(FullName, Function.createDelegate(this, this.UpdateProfileComplete));this.Hide();}
},
UpdateProfileComplete: function(fullname) {
$hide("mp_progress");if (fullname.length < 1) {
alert("Invalid return value");}
else {
$get('head_fullname').innerHTML = fullname;}
},
ShowLayout: function() {
WriteHistory("ShowLayout");this.ShowContent(2)
if (!this.Layout.Loaded) {
grabContent("/Menu/Layout.aspx", Function.createDelegate(this, this.DisplayLayout));}
},
DisplayLayout: function(content) {
this.Layout.Content.innerHTML = content;var Tab = myTabs.GetCurrentTab();if (Tab.obj.InnerHTML && Tab.obj.InnerHTML.length > 0) {
document.getElementById("layout_innerhtml").value = Tab.obj.InnerHTML;}
else {
var RB = "rb_" + Tab.obj.PanelWidth_1 + "_" + Tab.obj.PanelWidth_2 + "_" + Tab.obj.PanelWidth_3;$get(RB).checked = true;}
this.Layout.Loaded = true;},
ShowThemes: function() {
WriteHistory("ShowThemes");this.ShowContent(3);if (!this.Theme.Loaded) {
setElementToAjaxLoading(this.Theme.Content);JSON.Menu_GetThemes(Function.createDelegate(this, this.DisplayThemes));}
},
DisplayThemes: function(obj) {
if (obj && obj.length > 0) {
removeChildNodes(this.Theme.Content);for (var i = 0; i < obj.length; i++) {
var Item = obj[i];var e = document.createElement("div");e.id = "MenuTheme_" + i;e.appendChild(document.createTextNode(Item));this.Theme.Content.appendChild(e);installScript("$get('" + e.id + "').onclick = function(){Menu.ChangeTheme('" + Item + "');}");}
this.Theme.Loaded = false;}
else {
this.Theme.Content = "We are still working on the Themes Menu, please bear with us";}
},
ChangeTheme: function(theme) {
var AllLinks = document.getElementsByTagName("link");for (var i = 0; i < AllLinks.length; i++) {
var a = AllLinks[i];if (a.getAttribute("rel").indexOf("style") != -1) {
var href = a.getAttribute("href");var x = href.toLowerCase();var stringToFind = "app_themes/";var idx = x.toLowerCase().indexOf(stringToFind);if (idx > -1) {
idx = idx + stringToFind.length;var idx2 = x.indexOf("/", idx);if (idx2 > -1) {
a.href = x.substring(0, idx) + theme + x.substring(idx2);}
}
else {
}
}
}
}
}
if( typeof Proxy == "undefined" ) Proxy = ProxyAsync;var prm = Sys.WebForms.PageRequestManager.getInstance();var SearchEngine = 1;var SearchEngineDefaultString = "Google";function UpdateSearchEngine(val)
{
var banner_search = $('banner_search');var banner_search_txt = $('banner_search_txt');switch (val)
{
case 2:
banner_search.src = "/images/search/yahoo.gif";SearchEngineDefaultString = "Yahoo!";break;case 3:
banner_search.src = "/images/search/live.gif";SearchEngineDefaultString = "Live!";break;default:
banner_search.src = "/images/search/google.gif";SearchEngineDefaultString = "Google";break;}
SearchEngine = val;banner_search_txt.value = SearchEngineDefaultString;}
function Search_OnBlur(element)
{
if (element.value == "")
element.value = SearchEngineDefaultString;}
function Search_OnFocus(element)
{
if (element.value == SearchEngineDefaultString)
element.value = "";}
function Search_OnCRLF()
{
var url = "";var search_txt = $('banner_search_txt').value;switch (SearchEngine)
{
case 2:
url = "http://search.yahoo.com/search?p=" + encodeURI(search_txt);
break;case 3:
url = "http://search.live.com/results.aspx?q=" + encodeURI(search_txt);
break;default:
url = "http://www.google.com/search?q=" + encodeURI(search_txt);
break;}
winopen_withlocationbar(url);return false;}
var TabAccessLevel = {};TabAccessLevel.Owner = 0;TabAccessLevel.Tab_EditName = 1;TabAccessLevel.Tab_Share = 2;TabAccessLevel.Tab_Delete = 3;TabAccessLevel.Tab_AddWidgets = 4;TabAccessLevel.Tab_ChangeLayout = 5;TabAccessLevel.Tab_ChangeTheme = 6;TabAccessLevel.Widget_Edit = 7;TabAccessLevel.Widget_Reorder = 8;TabAccessLevel.Widget_Delete = 9;TabAccessLevel.Widget_EditTitle = 10;TabAccessLevel.Read = 11;function GetAccessLevelStr(lvl)
{
switch(lvl)
{
case 0:
return "Owner";case 1:
return "Edit Tab Name";case 2:
return "Share Tab to Others";case 3:
return "Delete Tab";case 4:
return "Add Widgets to Tab";case 5:
return "Change Tab Layout";case 6:
return "Change Tab Theme";case 7:
return "Edit Widget Properties";case 8:
return "Reorder Widget";case 9:
return "Delete Widget";case 10:
return "Edit Widget Title";case 11:
return "Read";default:
return "None";}
}
JSON.set_defaultFailedCallback(DefaultFailedCallback);function DefaultFailedCallback(error, userContext, methodName)
{
if(error !== null)
{
alert("Error occured at function: " + methodName + "\n" + error.get_message());}
}
if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded();var div_Widgets = null;var div_TabList = null;var div_tabHolder = null;var div_tabLastElement = null;var div_WidgetProgress = null;var div_Messages = null;var a_Messages = null;var Menu = null;function ShowPageHint(str, type)
{
if (type == 0)
{
$hide('div_hint');}
else
{
var obj = "";switch (type)
{
case 1:
obj += "<img src='/images/hint.png' border='0' />";break;}
obj += str;$show('div_hint');$('div_hint').innerHTML = obj;}
}
function ShowNoWidget()
{
div_NoWidgets.style.display = "";}
function HideNoWidget()
{
div_NoWidgets.style.display = "none";}
function setDebug(intVal)
{
if (intVal == 1)
{
$show('debug');}
else
{
$hide('debug');}
}
var Msg =
{
InitTicker: function() {
if (Msg.Ticker) {
}
else {
Msg.Ticker = "Ticker";Msg.TickerEnabled = true;Msg.TickerString = "";}
},
ToggleTicker: function() {
Msg.InitTicker();Msg.TickerEnabled = !Msg.TickerEnabled;if (Msg.TickerEnabled) {
$show(Msg.Ticker);}
else {
$hide(Msg.Ticker);}
},
HideTicker: function() {
Msg.InitTicker();$hide(Msg.Ticker);Msg.TickerEnabled = false;},
ShowTicker: function() {
Msg.InitTicker();$show(Msg.Ticker);Msg.TickerEnabled = true;},
ShowMessage: function() {
if (div_Messages.style.display.length == 0)
div_Messages.style.display = "none";else
div_Messages.style.display = "";},
RefreshMessages: function() {
setElementToAjaxLoading(div_Messages);JSON.GetMessages(Msg.RefreshMessagesPostBack);},
RefreshMessagesPostBack: function(dict) {
div_Messages.innerHTML = "";if (dict && parseInt(dict.Total) > 0) {
if (parseInt(dict.New) > 0) {
a_Messages.innerHTML = "<b>Messages(" + dict.Total + ")</b>";}
else {
a_Messages.innerHTML = "Messages(" + dict.Total + ")";}
Msg.InitTicker();Msg.TickerString = "";var ul = document.createElement("ul");for (var i = 0; i < dict.Messages.length; i++) {
var MsgItem = dict.Messages[i];var e = document.createElement("li");e.className = "message";e.innerHTML = MsgItem.Description;ul.appendChild(e);if (MsgItem.inTicker) {
Msg.TickerString += MsgItem.Title + ": " + MsgItem.TickerMessage + "&nbsp;&nbsp;|&nbsp;&nbsp;";}
}
if (Msg.TickerString.length > 0 && Msg.TickerEnabled) {
$('TickerMarquee').innerHTML = Msg.TickerString;$show(Msg.Ticker);Msg.TickerEnabled = true;}
else {
$('TickerMarquee').innerHTML = "<hr />";$hide(Msg.Ticker);Msg.TickerEnabled = false;}
var HTML = "<table border='0'><tr valign='" + (is_ie ? "top" : "middle") + "'><td><h4>Messages</h4></td><td>" +
"<img title='Refresh Messages' onclick='Msg.RefreshMessages()' border='0' src='" + PageTheme + "/refresh.gif' />&nbsp;" +
"<img title='Close Message Window' onclick='Msg.ShowMessage()' border='0' src='" + PageTheme + "/close.gif' />" +
"</td></tr></table><ul>" + ul.innerHTML + "</ul>";div_Messages.innerHTML = HTML;div_Messages.appendChild(document.createTextNode(" "));var a = document.createElement("a");a.innerHTML = "Toggle Ticker";a.onclick = Msg.ToggleTicker;a.href = "javascript:void(0)";div_Messages.appendChild(a);}
else {
a_Messages.innerHTML = "Messages(0)";div_Messages.innerHTML = "You have no messages";div_Messages.style.display = "none";}
}
}
function PageFirstLoad()
{
setTimeout(function(){
div_Widgets = $get("widgets");div_TabList = $get("tablist");div_NoWidgets = $get('div_nowidget');div_Messages = $get('div_Messages');div_tabHolder = $get('tabHolder');div_tabLastElement = $get('tabLastElement');a_Messages = $get('a_Messages');div_WidgetProgress = $get("progress");setElementToAjaxLoading(div_WidgetProgress);var today = new Date();WriteHistory("PageFirstLoad @ " + today);Menu_AddTarget('banner_search', 'banner_search_menu');var banner_search_txt = $('banner_search_txt');if (is_ie)
banner_search_txt.onkeypress = function(){if(event.keyCode==13){Search_OnCRLF();event.keyCode=0;return false;}};else
banner_search_txt.onkeypress = function(event){if(event.keyCode==13){Search_OnCRLF();return false;}};UpdateSearchEngine(1);Msg.RefreshMessages();setInterval("Msg.RefreshMessages()", 300000);Menu = new _menu();myTabs.FirstLoad();ShowPageHint("",0);tab_width = div_TabList.clientWidth;if (window)
window.onresize = resize;if (document.body)
document.body.onresize = resize;resize();var Scripts = document.getElementsByTagName("script");for(var i=0;i<Scripts.length;i++)
{
if (Scripts[i].src)
{
installScriptSrc_UpdateDict(Scripts[i]);}
}
RsaSecurityHelper.getSessionKey();}, 0);}
function resize()
{
myTabs.onTabChange();}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageFirstLoad)
installScriptSrc_UpdateDict('/js/ieupdate.js');installScriptSrc_UpdateDict('/js/scriptaculous/prototype.js');installScriptSrc_UpdateDict('/js/scriptaculous/effects.js');installScriptSrc_UpdateDict('/js/scriptaculous/dragdrop.js');installScriptSrc_UpdateDict('/js/scriptaculous/controls.js');installScriptSrc_UpdateDict('/js/browser.js');installScriptSrc_UpdateDict('/js/rsa.js');installScriptSrc_UpdateDict('/js/scripts.js');installScriptSrc_UpdateDict('/js/XmlObjtree.js');installScriptSrc_UpdateDict('/js/Generics.js');installScriptSrc_UpdateDict('/js/dragresize.js');installScriptSrc_UpdateDict('/js/wz_tooltip.js');installScriptSrc_UpdateDict('/js/tip_balloon.js');installScriptSrc_UpdateDict('/js/mywidgets.js');installScriptSrc_UpdateDict('/js/mypages.js');installScriptSrc_UpdateDict('/js/menu.js');installScriptSrc_UpdateDict('/js/generics2.js');installScriptSrc_UpdateDict('/js/default.aspx.js');